From: Matthew Fernandez Date: Tue, 22 Sep 2020 02:33:10 +0000 (-0700) Subject: remove direct use of environ X-Git-Tag: 2.46.0~20^2^2~62^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c45f0388350bd6f0cde2ec2abc0e5df523e766f5;p=graphviz remove direct use of environ This code was manually parsing environment variable settings for some reason. It also (incorrectly) assumed $_ would always be the first environment variable. --- diff --git a/lib/ast/pathpath.c b/lib/ast/pathpath.c index 6feb1e882..458beed54 100644 --- a/lib/ast/pathpath.c +++ b/lib/ast/pathpath.c @@ -82,8 +82,8 @@ char *pathpath(char *path, const char *p, const char *a, int mode) (strchr(s, '/') || (((s = cmd) || (opt_info_argv && (s = *opt_info_argv))) && strchr(s, '/') && !strchr(s, '\n') && !access(s, F_OK)) || - (environ && (s = *environ) && *s++ == '_' && - *s++ == '=' && strchr(s, '/') && !strneq(s, "/bin/", 5) && + ((s = getenv("_")) && + strchr(s, '/') && !strneq(s, "/bin/", 5) && !strneq(s, "/usr/bin/", 9)) || (*x && !access(x, F_OK) && (s = getenv("PWD")) && *s == '/') )