summaryrefslogtreecommitdiff
path: root/src/analyze/analyze-verify.c
diff options
context:
space:
mode:
authorMaanya Goenka <t-magoenka@microsoft.com>2021-08-04 12:00:31 -0700
committerMaanya Goenka <t-magoenka@microsoft.com>2021-08-10 10:14:12 -0700
commited80366139531e196e6582ab325f1c54efa2b384 (patch)
tree2817add48487286bf67680fa638b8e9ddc4c5912 /src/analyze/analyze-verify.c
parent36f4af05680d0f8f67b870bf72241d7d2fefd91b (diff)
downloadsystemd-ed80366139531e196e6582ab325f1c54efa2b384.tar.gz
systemd-analyze: add root to find and verify executable
Diffstat (limited to 'src/analyze/analyze-verify.c')
-rw-r--r--src/analyze/analyze-verify.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
index 99bce68ca4..9ef6868367 100644
--- a/src/analyze/analyze-verify.c
+++ b/src/analyze/analyze-verify.c
@@ -115,7 +115,7 @@ static int verify_socket(Unit *u) {
return 0;
}
-int verify_executable(Unit *u, const ExecCommand *exec) {
+int verify_executable(Unit *u, const ExecCommand *exec, const char *root) {
int r;
if (!exec)
@@ -124,14 +124,14 @@ int verify_executable(Unit *u, const ExecCommand *exec) {
if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
return 0;
- r = find_executable_full(exec->path, /* root= */ NULL, false, NULL, NULL);
+ r = find_executable_full(exec->path, root, false, NULL, NULL);
if (r < 0)
return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
return 0;
}
-static int verify_executables(Unit *u) {
+static int verify_executables(Unit *u, const char *root) {
ExecCommand *exec;
int r = 0, k;
unsigned i;
@@ -141,20 +141,20 @@ static int verify_executables(Unit *u) {
exec = u->type == UNIT_SOCKET ? SOCKET(u)->control_command :
u->type == UNIT_MOUNT ? MOUNT(u)->control_command :
u->type == UNIT_SWAP ? SWAP(u)->control_command : NULL;
- k = verify_executable(u, exec);
+ k = verify_executable(u, exec, root);
if (k < 0 && r == 0)
r = k;
if (u->type == UNIT_SERVICE)
for (i = 0; i < ELEMENTSOF(SERVICE(u)->exec_command); i++) {
- k = verify_executable(u, SERVICE(u)->exec_command[i]);
+ k = verify_executable(u, SERVICE(u)->exec_command[i], root);
if (k < 0 && r == 0)
r = k;
}
if (u->type == UNIT_SOCKET)
for (i = 0; i < ELEMENTSOF(SOCKET(u)->exec_command); i++) {
- k = verify_executable(u, SOCKET(u)->exec_command[i]);
+ k = verify_executable(u, SOCKET(u)->exec_command[i], root);
if (k < 0 && r == 0)
r = k;
}
@@ -189,7 +189,7 @@ static int verify_documentation(Unit *u, bool check_man) {
return r;
}
-static int verify_unit(Unit *u, bool check_man) {
+static int verify_unit(Unit *u, bool check_man, const char *root) {
_cleanup_(sd_bus_error_free) sd_bus_error err = SD_BUS_ERROR_NULL;
int r, k;
@@ -207,7 +207,7 @@ static int verify_unit(Unit *u, bool check_man) {
if (k < 0 && r == 0)
r = k;
- k = verify_executables(u);
+ k = verify_executables(u, root);
if (k < 0 && r == 0)
r = k;
@@ -278,7 +278,7 @@ int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run
}
for (i = 0; i < count; i++) {
- k = verify_unit(units[i], check_man);
+ k = verify_unit(units[i], check_man, root);
if (k < 0 && r == 0)
r = k;
}