process-util: make safe_fork() unset $NOTIFY_SOCKET
Propagating $NOTIFY_SOCKET is typically dangerous. Let's unset it unless explicitly requested to keep it. Fixes #27288. Replaces #27291.
This commit is contained in:
@@ -1365,6 +1365,14 @@ int safe_fork_full(
|
||||
}
|
||||
}
|
||||
|
||||
if (!FLAGS_SET(flags, FORK_KEEP_NOTIFY_SOCKET)) {
|
||||
r = RET_NERRNO(unsetenv("NOTIFY_SOCKET"));
|
||||
if (r < 0) {
|
||||
log_full_errno(prio, r, "Failed to unset $NOTIFY_SOCKET: %m");
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret_pid)
|
||||
*ret_pid = getpid_cached();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user