From: Theodore Ts'o Date: Fri, 24 Sep 2004 16:16:17 +0000 (-0400) Subject: Remove double "//" when listing attributes in the root directory or X-Git-Tag: E2FSPROGS-1_36~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=137ce8ca04265f1d46e622ed49ad6dbe922f6d63;p=thirdparty%2Fe2fsprogs.git Remove double "//" when listing attributes in the root directory or when there is a trailing '/' in the directory name. (Addresses Debian Bug #272943) --- diff --git a/debian/changelog b/debian/changelog index d3d46cb7d..3da4cf5c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,14 @@ e2fsprogs (1.35-8) unstable; urgency=low + * Remove double "//" when listing attributes in the root directory or + when there is a trailing '/' in the directory name. (Closes: #272943) * Make sure the configure files are newer than configure.in the debian/rules file so that a dpkg-source created patch won't trigger an attempt rebuild of the configure script. (Closes: #272558) * Make sure /usr/lib/e2initrd_helper is in the e2fsprogs package. (Closes: #272698) - -- Theodore Y. Ts'o Fri, 24 Sep 2004 11:51:36 -0400 + -- Theodore Y. Ts'o Fri, 24 Sep 2004 12:12:44 -0400 e2fsprogs (1.35-7) unstable; urgency=low diff --git a/misc/ChangeLog b/misc/ChangeLog index 10af4874d..f35d5a825 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,5 +1,9 @@ 2004-09-24 Theodore Ts'o + * lsattr.c (lsattr_dir_proc): Avoid double // when listing the + root directory, or when there is a trailing '/' in the + directory name. (Addresses Debian Bug #272943) + * Makefile.in: Make sure /usr/lib is created for when we install e2initrd_helper. diff --git a/misc/lsattr.c b/misc/lsattr.c index ff3859ff7..093f50f43 100644 --- a/misc/lsattr.c +++ b/misc/lsattr.c @@ -125,10 +125,14 @@ static int lsattr_dir_proc (const char * dir_name, struct dirent * de, { STRUCT_STAT st; char *path; + int dir_len = strlen(dir_name); - path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1); + path = malloc(dir_len + strlen (de->d_name) + 2); - sprintf (path, "%s/%s", dir_name, de->d_name); + if (dir_len && dir_name[dir_len-1] == '/') + sprintf (path, "%s%s", dir_name, de->d_name); + else + sprintf (path, "%s/%s", dir_name, de->d_name); if (LSTAT (path, &st) == -1) perror (path); else {