[hackers] [sbase] which: Don't look for paths with slashes in $PATH || Michael Forney

From: <git_AT_suckless.org>
Date: Sat, 21 Oct 2017 21:57:39 +0200 (CEST)

commit 3b604b179c501257b50baadbc8700895a66dc876
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Fri Oct 20 12:31:27 2017 -0700
Commit: Michael Forney <mforney_AT_mforney.org>
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
_AT_@ -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);
Received on Sat Oct 21 2017 - 21:57:39 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 21 2017 - 22:00:41 CEST