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