summaryrefslogtreecommitdiff
path: root/src/remove.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-08-22 20:02:34 +0200
committerJim Meyering <jim@meyering.net>2007-08-22 20:02:34 +0200
commit0918810a7d1433ebfc4f8cda4e50303f99425006 (patch)
tree44ebd258fa8b5ebcab011a8aa5d4bd408a81c62b /src/remove.c
parent55539fc6bd772c4c0f80e0a2e17867294b91014d (diff)
downloadcoreutils-0918810a7d1433ebfc4f8cda4e50303f99425006.tar.xz
Change "rm --verbose -r a//" not to print extra slashes in a///b
* src/remove.c (push_dir): Don't copy trailing slashes onto the stack. Reported by François Pinard. * tests/rm/v-slash: New file. Test for the above change. * tests/rm/Makefile.am (TESTS): Add v-slash.
Diffstat (limited to 'src/remove.c')
-rw-r--r--src/remove.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/remove.c b/src/remove.c
index 58072adde..773ed12dc 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -220,6 +220,10 @@ push_dir (Dirstack_state *ds, const char *dir_name)
{
size_t len = strlen (dir_name);
+ /* Don't copy trailing slashes. */
+ while (1 < len && dir_name[len - 1] == '/')
+ --len;
+
/* Append the string onto the stack. */
obstack_grow (&ds->dir_stack, dir_name, len);