summaryrefslogtreecommitdiffstats
path: root/commands/ls.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/ls.c')
-rw-r--r--commands/ls.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/commands/ls.c b/commands/ls.c
index 1fdb244..f2d9903 100644
--- a/commands/ls.c
+++ b/commands/ls.c
@@ -73,12 +73,13 @@ int ls(const char *path, ulong flags)
while ((d = readdir(dir))) {
sprintf(tmp, "%s/%s", path, d->d_name);
- if (lstat(tmp, &s))
- goto out;
- if (flags & LS_COLUMN)
+ if (flags & LS_COLUMN) {
string_list_add_sorted(&sl, d->d_name);
- else
+ } else {
+ if (lstat(tmp, &s))
+ goto out;
ls_one(d->d_name, tmp, &s);
+ }
}
closedir(dir);