OSDN Git Service
(root)
/
android-x86
/
external-toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
28727ba
)
Don't depend on malloc(0) to return non-null.
author
Rob Landley
<rob@landley.net>
Tue, 23 Jun 2015 18:15:13 +0000
(13:15 -0500)
committer
Rob Landley
<rob@landley.net>
Tue, 23 Jun 2015 18:15:13 +0000
(13:15 -0500)
toys/posix/ls.c
patch
|
blob
|
history
diff --git
a/toys/posix/ls.c
b/toys/posix/ls.c
index
5dc392c
..
bba3431
100644
(file)
--- 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