aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-10-30 05:32:54 -0500
committerRob Landley <rob@landley.net>2014-10-30 05:32:54 -0500
commitbaa7f5cad548d8eceed45bebe4631f0e177bd8f0 (patch)
treecd9ed71ac644898985a44d7f0878ec6ed80dad76 /toys
parent448c874348e3426be99a52c8a8c284cd35ac43b1 (diff)
downloadtoybox-baa7f5cad548d8eceed45bebe4631f0e177bd8f0.tar.gz
Bug report from Isaac Dunham: ls -d shouldn't follow command line symlinks without -H or -L (just like ls -l).
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/ls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index ee8dbc09..37da4497 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -487,8 +487,8 @@ void ls_main(void)
// 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;