2002-02-12 Havoc Pennington <hp@redhat.com>

Author: hp
Date: 2002-02-12 21:30:57 GMT
2002-02-12  Havoc Pennington  <hp@redhat.com>

	* pkg.c (scan_dir): use g_strdup, and fix the location where
	we assign the nul byte, so we don't mangle things for directories
	that end in '/' - reported by Enrico Scholz
This commit is contained in:
Arch Librarian 2005-07-14 13:05:01 +00:00
parent e810d6b406
commit 3e813e2dfc
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2002-02-12 Havoc Pennington <hp@redhat.com>
* pkg.c (scan_dir): use g_strdup, and fix the location where
we assign the nul byte, so we don't mangle things for directories
that end in '/' - reported by Enrico Scholz
2002-02-07 Havoc Pennington <hp@redhat.com>
* configure.in: 0.11.0

4
pkg.c
View file

@ -101,12 +101,12 @@ scan_dir (const char *dirname)
/* Use a copy of dirname cause Win32 opendir doesn't like
* superfluous trailing (back)slashes in the directory name.
*/
char *dirname_copy = strdup (dirname);
char *dirname_copy = g_strdup (dirname);
if (dirnamelen > 1 && dirname[dirnamelen-1] == G_DIR_SEPARATOR)
{
dirnamelen--;
dirname_copy[dirnamelen-1] = '\0';
dirname_copy[dirnamelen] = '\0';
}
dir = opendir (dirname_copy);