commit 38cc01b8874900eab684d70847b8ca3a3e580a0f
parent 3b604b179c501257b50baadbc8700895a66dc876
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 20 Oct 2017 22:26:30 -0700
which: Minor simplification
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/which.c b/which.c
@@ -50,12 +50,10 @@ which(const char *path, const char *name)
if (i && ptr[i - 1] != '/')
fputc('/', stdout);
puts(name);
- if (!aflag) {
- close(dirfd);
- break;
- }
}
close(dirfd);
+ if (!aflag && found)
+ break;
}
p = ptr + i + 1;
}