]> granicus.if.org Git - graphviz/commitdiff
pathpath: replace PATH_EXECUTE pathexists call with X_OK access call
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 4 Aug 2021 04:09:34 +0000 (21:09 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 10 Aug 2021 14:52:53 +0000 (07:52 -0700)
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

index b3790a871e252e1f2b8abd70c3671d2aa9027703..10cc57812fbb230eb85205f69dfc6428715ab91d 100644 (file)
@@ -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;