Skip to content

Commit fd40e02

Browse files
committed
safe_exec exits the child process directly on execve failure
The child side of safe_exec calls exit(1) after a failed execve, which can run atexit handlers and flush shared stdio buffers. The comment notes this should “error instead of exit.” Updated safe_exec in the audit daemon to terminate failing child processes with _exit(EXIT_FAILURE) rather than exit(1), preventing execution of atexit handlers and aligning shutdown behavior with POSIX recommendations.
1 parent 1984f2a commit fd40e02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/auditd-event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ static pid_t safe_exec(const char *exe)
14831483
argv[1] = NULL;
14841484
execve(exe, argv, NULL);
14851485
audit_msg(LOG_ALERT, "Audit daemon failed to exec %s", exe);
1486-
exit(1); /* FIXME: Maybe this should error instead of exit */
1486+
_exit(EXIT_FAILURE); // Avoid running the atexit handlers
14871487
}
14881488

14891489
static void reconfigure(struct auditd_event *e)

0 commit comments

Comments
 (0)