From: Matthew Fernandez Date: Wed, 4 Aug 2021 04:09:34 +0000 (-0700) Subject: pathpath: replace PATH_EXECUTE pathexists call with X_OK access call X-Git-Tag: 2.49.0~25^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5d946561241a84e665a80d705b365811dbf2f8a;p=graphviz pathpath: replace PATH_EXECUTE pathexists call with X_OK access call 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. --- 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;