summaryrefslogtreecommitdiff
path: root/src/remove.c
diff options
context:
space:
mode:
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);