copy: change error code when hitting copy limit to EFBIG

After all, this is about files, not arguments, hence EFBIG is more
appropriate than E2BIG
This commit is contained in:
Lennart Poettering 2014-11-06 21:20:32 +01:00
parent cda134ab1e
commit 84ee096044
2 changed files with 2 additions and 2 deletions

View File

@ -329,7 +329,7 @@ static int save_external_coredump(
}
r = copy_bytes(STDIN_FILENO, fd, arg_process_size_max);
if (r == -E2BIG) {
if (r == -EFBIG) {
log_error("Coredump of %s (%s) is larger than configured processing limit, refusing.", info[INFO_PID], info[INFO_COMM]);
goto fail;
} else if (IN_SET(r, -EDQUOT, -ENOSPC)) {

View File

@ -37,7 +37,7 @@ int copy_bytes(int fdf, int fdt, off_t max_bytes) {
if (max_bytes != (off_t) -1) {
if (max_bytes <= 0)
return -E2BIG;
return -EFBIG;
if ((off_t) m > max_bytes)
m = (size_t) max_bytes;