commit 3b604b179c501257b50baadbc8700895a66dc876
parent 44265b29ce2da27a525c72e3e9b48f3233535ec1
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 20 Oct 2017 12:31:27 -0700
which: Don't look for paths with slashes in $PATH
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/which.c b/which.c
@@ -31,10 +31,10 @@ which(const char *path, const char *name)
int dirfd, found = 0;
if (strchr(name, '/')) {
- if (canexec(AT_FDCWD, name)) {
+ found = canexec(AT_FDCWD, name);
+ if (found)
puts(name);
- return 1;
- }
+ return found;
}
ptr = p = enstrdup(3, path);