From 0918810a7d1433ebfc4f8cda4e50303f99425006 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 22 Aug 2007 20:02:34 +0200 Subject: 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/remove.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2