From 3e813e2dfc2d4d2fc2f58fe0efc312e7ed2f3015 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Thu, 14 Jul 2005 13:05:01 +0000 Subject: [PATCH] 2002-02-12 Havoc Pennington Author: hp Date: 2002-02-12 21:30:57 GMT 2002-02-12 Havoc Pennington * 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 --- ChangeLog | 6 ++++++ pkg.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4da2667..cc40b0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-02-12 Havoc Pennington + + * 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 * configure.in: 0.11.0 diff --git a/pkg.c b/pkg.c index 50450eb..c3f6e72 100644 --- a/pkg.c +++ b/pkg.c @@ -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); -- 2.39.5