(main): Remove trailing slashes from command line arguments.
authorJim Meyering <jim@meyering.net>
Thu, 20 Feb 1997 04:54:56 +0000 (04:54 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 20 Feb 1997 04:54:56 +0000 (04:54 +0000)
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

index 6a96a5b..67e3723 100644 (file)
--- 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)
     {