aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-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;