From: Matthew Fernandez Date: Tue, 11 Oct 2022 01:19:18 +0000 (-0700) Subject: gvc gvplugin_library_load: replace read check using 'stat' with using 'access' X-Git-Tag: 7.0.0~13^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30e3b20544baf15a8efb034e9b244188b8540d3c;p=graphviz gvc gvplugin_library_load: replace read check using 'stat' with using 'access' This probably uses `stat` under the hood too, but is slightly more concise and clear about intent. --- diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 542c1f2e3..1618efc62 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -13,8 +13,7 @@ #include #include #include -#include -#include +#include #ifdef ENABLE_LTDL #include @@ -159,7 +158,6 @@ gvplugin_library_t *gvplugin_library_load(GVC_t * gvc, char *path) static size_t lenp; char *libdir; char *suffix = "_LTX_library"; - struct stat sb; if (!gvc->common.demand_loading) return NULL; @@ -188,7 +186,7 @@ gvplugin_library_t *gvplugin_library_load(GVC_t * gvc, char *path) } hndl = lt_dlopen(p); if (!hndl) { - if (stat(p, &sb) == 0) { + if (access(p, R_OK) == 0) { agerr(AGWARN, "Could not load \"%s\" - %s\n", p, "It was found, so perhaps one of its dependents was not. Try ldd."); } else {