Skip to content

Commit

Permalink
libpkg/pkg_status.c: keep the getenv() value in a variable
Browse files Browse the repository at this point in the history
Same as commit: aa1ef79

Signed-off-by: rilysh <[email protected]>
  • Loading branch information
rilysh authored and bapt committed Mar 8, 2024
1 parent a669c9c commit 4ac6289
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libpkg/pkg_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ static bool
is_exec_at_localbase(const char *progname)
{
char pkgpath[MAXPATHLEN];
char *env;
bool result = true;

if ((env = getenv("LOCALBASE")) == NULL)
env = _LOCALBASE;

snprintf(pkgpath, sizeof(pkgpath), "%s/sbin/%s",
getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE,
progname);
env, progname);
if (access(pkgpath, X_OK) == -1)
result = false;

Expand Down

0 comments on commit 4ac6289

Please sign in to comment.