summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-02-21 16:07:26 +0000
committerSimon McVittie <smcv@collabora.com>2022-02-25 14:57:18 +0000
commitb38a39884c44470a70a703bba2ff4353c616bb97 (patch)
treea14a3c780286550d604a72eb0c087e9a905e004d
parentc32b5cc4ed4ec04cd8554098b67cdff640edf927 (diff)
downloaddbus-b38a39884c44470a70a703bba2ff4353c616bb97.tar.gz
sysdeps-unix: Diagnose failure to open /proc/self/oom_score_adj
Previously, we silently ignored this, but now that we're more careful about the contexts in which we try to reset the OOM score and whether we log failures as a warning, we can let the dbus-daemon-launch-helper show a message if it can't write there. Signed-off-by: Simon McVittie <smcv@collabora.com> (cherry picked from commit 226f24144a4db4898a1f5958293d200b975baee0)
-rw-r--r--dbus/dbus-sysdeps-util-unix.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index ffbc7aea..bed6fd3e 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -1658,12 +1658,19 @@ _dbus_reset_oom_score_adj (const char **error_str_p)
/* Success */
ret = TRUE;
}
- else
+ else if (errno == ENOENT)
{
- /* TODO: Historically we ignored this error, although ideally we
- * would diagnose it */
+ /* If /proc/self/oom_score_adj doesn't exist, assume the kernel
+ * doesn't support this feature and ignore it. */
ret = TRUE;
}
+ else
+ {
+ ret = FALSE;
+ error_str = "open(/proc/self/oom_score_adj)";
+ saved_errno = errno;
+ goto out;
+ }
out:
if (fd >= 0)