From d5d946561241a84e665a80d705b365811dbf2f8a Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 3 Aug 2021 21:09:34 -0700 Subject: [PATCH] pathpath: replace PATH_EXECUTE pathexists call with X_OK access call MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is equivalent and relies solely on standard library functionality. This effectively inlines and simplifies the call to pathexists that previously existed. The caching pathexists does is no longer relevant. An improved version of this is provided by a modern operating system’s buffer cache. --- lib/ast/pathpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ast/pathpath.c b/lib/ast/pathpath.c index b3790a871..10cc57812 100644 --- a/lib/ast/pathpath.c +++ b/lib/ast/pathpath.c @@ -95,7 +95,7 @@ char *pathpath(char *path, const char *p) goto normal; while (*--s != '/'); strcpy(s + 1, "bin"); - if (pathexists(path, PATH_EXECUTE)) { + if (access(path, X_OK) == 0) { if ((s = pathaccess(path, path, p, a, PATH_REGULAR))) return path == buf ? strdup(s) : s; goto normal; -- 2.49.0