Revert "Fix showing directories when -R flag is set in ls(1)"
This reverts commit bb83eade39
.
This commit causes the loop through dents at the end of main to
continue past the end of the dents array, causing a crash when
called with multiple directory arguments.
This commit is contained in:
parent
229d7cc89a
commit
b91b9e79ec
2
ls.c
2
ls.c
@ -278,7 +278,7 @@ lsdir(const char *path, const struct entry *dir)
|
|||||||
if (!Uflag)
|
if (!Uflag)
|
||||||
qsort(ents, n, sizeof(*ents), entcmp);
|
qsort(ents, n, sizeof(*ents), entcmp);
|
||||||
|
|
||||||
if (ds++)
|
if (ds > 1 && (path[0] || dir->name[0] != '.'))
|
||||||
printf("%s:\n", dir->name);
|
printf("%s:\n", dir->name);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
output(&ents[i]);
|
output(&ents[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user