diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-23 16:28:05 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-23 16:28:05 +0200 |
commit | 93240d3aba4611dd966c5b9f7368d20612211486 (patch) | |
tree | b00bfed80c8ac4523424f1bdef1607f3c0513d4a /src/journal | |
parent | 81cef14fce9c64afed600614403ecae7cd79781d (diff) |
coredump: never write more than the configured processing size limit to disk
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/coredump.c | 10 | ||||
-rw-r--r-- | src/journal/coredumpctl.c | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c index 764c5e72ab..1b35eb1698 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -240,8 +240,14 @@ static int save_external_coredump(char **argv, uid_t uid, char **ret_filename, i return -errno; } - r = copy_bytes(STDIN_FILENO, fd); - if (r < 0) { + r = copy_bytes(STDIN_FILENO, fd, arg_process_size_max); + if (r == -E2BIG) { + log_error("Coredump of %s (%s) is larger than configured processing limit, refusing.", argv[ARG_PID], argv[ARG_COMM]); + goto fail; + } else if (IN_SET(r, -EDQUOT, -ENOSPC)) { + log_error("Not enough disk space for coredump of %s (%s), refusing.", argv[ARG_PID], argv[ARG_COMM]); + goto fail; + } else if (r < 0) { log_error("Failed to dump coredump to file: %s", strerror(-r)); goto fail; } diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index fefd02bc9b..48e63415b1 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -659,7 +659,7 @@ static int dump_core(sd_journal* j) { return -errno; } - r = copy_bytes(fd, output ? fileno(output) : STDOUT_FILENO); + r = copy_bytes(fd, output ? fileno(output) : STDOUT_FILENO, (off_t) -1); if (r < 0) { log_error("Failed to stream coredump: %s", strerror(-r)); return r; |