From 4af2c36dfa5a29dc358b3ac192560c48a9c8a188 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 20 Feb 1997 04:54:56 +0000 Subject: [PATCH] (main): Remove trailing slashes from command line arguments. Otherwise, running `mkdir x; chmod 644 x; ls -d x/' (note the trailing slash) makes ls fail with permission denied on at least Linux 1.2.13 and 2.0.14 systems. --- src/ls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ls.c b/src/ls.c index 6a96a5b9a..67e372370 100644 --- a/src/ls.c +++ b/src/ls.c @@ -698,7 +698,10 @@ main (int argc, char **argv) if (i < argc) dir_defaulted = 0; for (; i < argc; i++) - gobble_file (argv[i], 1, ""); + { + strip_trailing_slashes (argv[i]); + gobble_file (argv[i], 1, ""); + } if (dir_defaulted) {