commit 3b604b179c501257b50baadbc8700895a66dc876
Author: Michael Forney <[email protected]>
AuthorDate: Fri Oct 20 12:31:27 2017 -0700
Commit: Michael Forney <[email protected]>
CommitDate: Sat Oct 21 12:44:09 2017 -0700
which: Don't look for paths with slashes in $PATH
diff --git a/which.c b/which.c
index e47aa63..1e64452 100644
--- 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);