changeset 1540:dabe462d290b

Bug report from Isaac Dunham: ls -d shouldn't follow command line symlinks without -H or -L (just like ls -l).
author Rob Landley <rob@landley.net>
date Thu, 30 Oct 2014 05:32:54 -0500
parents 3e85af1f7e22
children 28b0987d4952
files toys/posix/ls.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/toys/posix/ls.c	Wed Oct 29 18:44:33 2014 -0500
+++ b/toys/posix/ls.c	Thu Oct 30 05:32:54 2014 -0500
@@ -487,8 +487,8 @@
   // Non-absolute paths are relative to current directory.
   TT.files = dirtree_add_node(0, 0, 0);
   for (s = *toys.optargs ? toys.optargs : noargs; *s; s++) {
-    dt = dirtree_add_node(0, *s,
-      (toys.optflags & (FLAG_L|FLAG_H|FLAG_l))^FLAG_l);
+    dt = dirtree_add_node(0, *s, !(toys.optflags & (FLAG_l|FLAG_d))
+      || (toys.optflags & (FLAG_L|FLAG_H)));
 
     if (!dt) {
       toys.exitval = 1;