summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/fs.c11
-rw-r--r--src/util/string.c6
2 files changed, 8 insertions, 9 deletions
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);
}
diff --git a/src/util/string.c b/src/util/string.c
index b17823e..94e1cc1 100644
--- a/src/util/string.c
+++ b/src/util/string.c
@@ -105,12 +105,12 @@ size_t _strjoin_r(
return len;
}
-/** NOTE: the _ argument is added to "hack" around undefined behaviour if the
+/** NOTE: the _ argument is added to "hack" around undefined behaviour if the
* last non-variadic argument undergoes argument promotion.
* This results in a compile error on (at least) clang:
*
- * src/util/string.c:130:16: error: passing an object that undergoes default
- * argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
+ * src/util/string.c:130:16: error: passing an object that undergoes default
+ * argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
*/
char *_strjoin(char sep, void *_, /* const char *restrict */...) {
va_list ap;