mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 22:48:02 +02:00
sysdeps-unix: check fd before calling _dbus_fd_set_close_on_exec()
If /proc/self/oom_score_adj does not exist, fd will invalid (-1). Attempting to set the CLOEXEC flag will obviously fail, and we lose the original errno value from open(). Bug: https://bugs.gentoo.org/834725 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
This commit is contained in:
parent
b56cad123c
commit
769a0462be
1 changed files with 2 additions and 1 deletions
|
|
@ -1633,7 +1633,8 @@ _dbus_reset_oom_score_adj (const char **error_str_p)
|
|||
if (fd < 0)
|
||||
{
|
||||
fd = open ("/proc/self/oom_score_adj", O_RDWR);
|
||||
_dbus_fd_set_close_on_exec (fd);
|
||||
if (fd >= 0)
|
||||
_dbus_fd_set_close_on_exec (fd);
|
||||
}
|
||||
|
||||
if (fd >= 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue