summaryrefslogtreecommitdiff
path: root/src/basic/path-util.h
diff options
context:
space:
mode:
authorMaanya Goenka <t-magoenka@microsoft.com>2021-08-04 11:59:45 -0700
committerMaanya Goenka <t-magoenka@microsoft.com>2021-08-10 10:14:01 -0700
commit36f4af05680d0f8f67b870bf72241d7d2fefd91b (patch)
tree9c32df8ae1dd88800bf92331de6bd308738e1f55 /src/basic/path-util.h
parente5ea5c3a17c6b8916c35abb665fd926d2d9ff41b (diff)
downloadsystemd-36f4af05680d0f8f67b870bf72241d7d2fefd91b.tar.gz
path-util: teach find_executable_full how to look into the root directory
When the root parameter in find_executable_full is set, chase_symlinks prefixes this root to every check of the path name to find the complete path of the execuatble in case the path provided is not absolute. This is only done for the non NULL root because otherwise the chase_symlinks function would alter the behavior of some of the callers which would in turn alter the outputs in a way that is undesirable. The find_execuatble_full function is invoked by the verify_executable function in analyze-verify.
Diffstat (limited to 'src/basic/path-util.h')
-rw-r--r--src/basic/path-util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 26e7362d1f..0d69145497 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -99,9 +99,9 @@ int path_strv_make_absolute_cwd(char **l);
char** path_strv_resolve(char **l, const char *root);
char** path_strv_resolve_uniq(char **l, const char *root);
-int find_executable_full(const char *name, bool use_path_envvar, char **ret_filename, int *ret_fd);
+int find_executable_full(const char *name, const char *root, bool use_path_envvar, char **ret_filename, int *ret_fd);
static inline int find_executable(const char *name, char **ret_filename) {
- return find_executable_full(name, true, ret_filename, NULL);
+ return find_executable_full(name, /* root= */ NULL, true, ret_filename, NULL);
}
bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);