Skip to content

Commit

Permalink
analyze: resolve executable path if it is relative
Browse files Browse the repository at this point in the history
Fixes #18252.
  • Loading branch information
yuwata committed Jan 18, 2021
1 parent ece852c commit b9b442a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/analyze/analyze-verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,17 @@ static int verify_socket(Unit *u) {
}

int verify_executable(Unit *u, const ExecCommand *exec) {
int r;

if (!exec)
return 0;

if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
return 0;

if (access(exec->path, X_OK) < 0)
return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path);
r = find_executable_full(exec->path, false, NULL, NULL);
if (r < 0)
return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);

return 0;
}
Expand Down

0 comments on commit b9b442a

Please sign in to comment.