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:
17a94c5
)
Don't segfault if none of the file arguments to ls exists.
author
Rob Landley
<rob@landley.net>
Tue, 23 Jun 2015 18:56:53 +0000
(13:56 -0500)
committer
Rob Landley
<rob@landley.net>
Tue, 23 Jun 2015 18:56:53 +0000
(13:56 -0500)
toys/posix/ls.c
patch
|
blob
|
history
diff --git
a/toys/posix/ls.c
b/toys/posix/ls.c
index
bba3431
..
44915fa
100644
(file)
--- a/
toys/posix/ls.c
+++ b/
toys/posix/ls.c
@@
-298,7
+298,8
@@
static void listfiles(int dirfd, struct dirtree *indir)
// Silently descend into single directory listed by itself on command line.
// In this case only show dirname/total header when given -R.
dt = indir->child;
- if (S_ISDIR(dt->st.st_mode) && !dt->next && !(flags&(FLAG_d|FLAG_R))) {
+ if (dt && S_ISDIR(dt->st.st_mode) && !dt->next && !(flags&(FLAG_d|FLAG_R)))
+ {
listfiles(open(dt->name, 0), TT.singledir = dt);
return;