aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/ls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index 5dc392c9..bba34313 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -320,7 +320,7 @@ static void listfiles(int dirfd, struct dirtree *indir)
for (sort = 0;;sort = xmalloc(dtlen*sizeof(void *))) {
for (dtlen = 0, dt = indir->child; dt; dt = dt->next, dtlen++)
if (sort) sort[dtlen] = dt;
- if (sort) break;
+ if (sort || !dtlen) break;
}
// Label directory if not top of tree, or if -R