diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-10 18:37:54 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:50:04 +0200 |
commit | 5a98bb37ef28a1a0cfcb6676c469982d47997287 (patch) | |
tree | ab4b2c64c070d39389f51471ffe6d3fd182355b4 /src/basic | |
parent | d3b8f2c9f92d150872d846471d2de18bfbbda02c (diff) |
util: minor tweaks to disable_core_dumps()
First, let's rename it to disable_coredumps(), as in the rest of our
codebase we spell it "coredump" rather than "core_dump", so let's stick
to that.
However, also log about failures to turn off core dumpling on LOG_DEBUG,
because debug logging is always a good idea.
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/util.c | 12 | ||||
-rw-r--r-- | src/basic/util.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index f60f60b02..e23266ba3 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -628,7 +628,13 @@ int str_verscmp(const char *s1, const char *s2) { } /* Turn off core dumps but only if we're running outside of a container. */ -void disable_core_dumps(void) { - if (detect_container() <= 0) - (void) write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); +void disable_coredumps(void) { + int r; + + if (detect_container() > 0) + return; + + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); + if (r < 0) + log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); } diff --git a/src/basic/util.h b/src/basic/util.h index 643ce3bc4..de042509f 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -206,4 +206,4 @@ int version(void); #endif // 0 int str_verscmp(const char *s1, const char *s2); -void disable_core_dumps(void); +void disable_coredumps(void); |