sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit b91b9e79ec3b4f0d19c4697acefe01b0f4cc0d6e
parent 229d7cc89a051ab139c6db889c864d1edb378e5a
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 14 May 2016 18:56:50 -0700

Revert "Fix showing directories when -R flag is set in ls(1)"

This reverts commit bb83eade399e7d6f3642ae3a5e2cdebab6f222a1.

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.

Diffstat:
Mls.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ls.c b/ls.c @@ -278,7 +278,7 @@ lsdir(const char *path, const struct entry *dir) if (!Uflag) qsort(ents, n, sizeof(*ents), entcmp); - if (ds++) + if (ds > 1 && (path[0] || dir->name[0] != '.')) printf("%s:\n", dir->name); for (i = 0; i < n; i++) output(&ents[i]);