mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-04 13:00:26 +01:00
spawn-unix: Don't log an error if unable to reset Linux OOM score
We cannot safely log between fork() and exec() because it isn't an
async-signal-safe operation (in particular it might allocate memory).
We also don't want to treat a failure here as a real problem, because
it might legitimately not work: in a system dbus-daemon that has dropped
privileges from root, the pseudo-file representing this process parameter
remains owned by root and cannot be altered by the unprivileged user.
For the main use-case for this operation, the system dbus-daemon, we
have another opportunity to do this in the dbus-daemon-launch-helper
(see the previous commit).
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7ee72a2795)
This commit is contained in:
parent
e7a4123d6e
commit
c32b5cc4ed
1 changed files with 5 additions and 7 deletions
|
|
@ -1397,13 +1397,11 @@ _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p,
|
|||
}
|
||||
else if (grandchild_pid == 0)
|
||||
{
|
||||
const char *error_str = NULL;
|
||||
|
||||
if (!_dbus_reset_oom_score_adj (&error_str))
|
||||
{
|
||||
/* TODO: Strictly speaking, this is not async-signal-safe. */
|
||||
_dbus_warn ("%s: %s", error_str, strerror (errno));
|
||||
}
|
||||
/* This might not succeed in a dbus-daemon that started as root
|
||||
* and dropped privileges, so don't log an error on failure.
|
||||
* (Also, we can't safely log errors here anyway, because logging
|
||||
* is not async-signal safe). */
|
||||
_dbus_reset_oom_score_adj (NULL);
|
||||
|
||||
/* Go back to ignoring SIGPIPE, since it's evil
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue