which: Don't look for paths with slashes in $PATH
This commit is contained in:
6
which.c
6
which.c
@@ -31,10 +31,10 @@ which(const char *path, const char *name)
|
|||||||
int dirfd, found = 0;
|
int dirfd, found = 0;
|
||||||
|
|
||||||
if (strchr(name, '/')) {
|
if (strchr(name, '/')) {
|
||||||
if (canexec(AT_FDCWD, name)) {
|
found = canexec(AT_FDCWD, name);
|
||||||
|
if (found)
|
||||||
puts(name);
|
puts(name);
|
||||||
return 1;
|
return found;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = p = enstrdup(3, path);
|
ptr = p = enstrdup(3, path);
|
||||||
|
Reference in New Issue
Block a user