From 12f170a3891f5c4c850262730f525919d3a62bdf Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Thu, 25 Aug 2022 22:23:50 +0200 Subject: Stilistic changes --- src/util/fs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/util/fs.c') diff --git a/src/util/fs.c b/src/util/fs.c index 762c9a5..16a2c36 100644 --- a/src/util/fs.c +++ b/src/util/fs.c @@ -131,10 +131,9 @@ void which( char *path = NULL; /* check if name is a path */ - if (realpath(name, resolved_path)) { - if (access(resolved_path, X_OK)) { - return; - } + if (realpath(name, resolved_path) + && access(resolved_path, X_OK)) { + return; } resolved_path[0] = '\0'; @@ -180,11 +179,11 @@ void which( break; } while ((path_tok = strtok_r(NULL, stringize(PATHSEP), &saveptr))); + free(path); + if (!is_empty_string(resolved_path)) { sk_debug("resolved command %s: %s", name, resolved_path); } else { sk_warn("could not resolve command: %s", name); } - - free(path); } -- cgit v1.2.3