sbase

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

commit 46495ea902071bd0b2397c5cad4d49ec22d491f9
parent e92a1aef54570e86d778da84847e6d8d9e924487
Author: David Phillips <david@sighup.nz>
Date:   Tue, 22 Aug 2017 16:51:37 +1200

ls: abort a directory if we cannot opendir it

We should not try and perform operations on an invalid DIR* stream.
Instead, we shall let the error message be printed, and the return
code set (existing behaviour) and abort afterwards.

Diffstat:
Mls.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/ls.c b/ls.c @@ -250,6 +250,7 @@ lsdir(const char *path, const struct entry *dir) if (!(dp = opendir(dir->name))) { ret = 1; weprintf("opendir %s%s:", path, dir->name); + return; } if (chdir(dir->name) < 0) eprintf("chdir %s:", dir->name);