From baa7f5cad548d8eceed45bebe4631f0e177bd8f0 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 30 Oct 2014 05:32:54 -0500 Subject: Bug report from Isaac Dunham: ls -d shouldn't follow command line symlinks without -H or -L (just like ls -l). --- toys/posix/ls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/posix') 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; -- cgit v1.2.3