aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-10-27 23:12:48 -0500
committerRob Landley <rob@landley.net>2015-10-27 23:12:48 -0500
commit87f6a93fc594934b21fcd0e9d42baad2abb209ae (patch)
tree7bf5ab8a1b99a466bf8ab5406194f73e6de755af
parent10a942f7a67fe7f8dc6c17c3115449f5034fb607 (diff)
downloadtoybox-87f6a93fc594934b21fcd0e9d42baad2abb209ae.tar.gz
Fix ls error message for chmod -r directories.
Also, if you mkdir "$(echo -e "one\ntwo"); chmod -r one*; ls -q one* it honors -q.
-rw-r--r--toys/posix/ls.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index c815ab63..968b2537 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -297,6 +297,13 @@ static void listfiles(int dirfd, struct dirtree *indir)
*colsizes = (unsigned *)(toybuf+260), columns = (sizeof(toybuf)-260)/4;
char tmp[64];
+ if (-1 == dirfd) {
+ strwidth(indir->name);
+ perror_msg("%s", indir->name);
+
+ return;
+ }
+
memset(totals, 0, sizeof(totals));
// Top level directory was already populated by main()