From: Lennart Poettering Date: Fri, 23 Mar 2018 17:26:58 +0000 (+0100) Subject: copy: reduce number of checks X-Git-Tag: v239~416^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd641ad1b8c196208aaf74ccfd1f0a0598745484;p=thirdparty%2Fsystemd.git copy: reduce number of checks We check max_bytes twice here, let's simplify that, and reduce one level of indentation. --- diff --git a/src/basic/copy.c b/src/basic/copy.c index 96d059d0e50..55394871fdf 100644 --- a/src/basic/copy.c +++ b/src/basic/copy.c @@ -169,13 +169,11 @@ int copy_bytes_full( for (;;) { ssize_t n; - if (max_bytes != (uint64_t) -1) { - if (max_bytes <= 0) - return 1; /* return > 0 if we hit the max_bytes limit */ + if (max_bytes <= 0) + return 1; /* return > 0 if we hit the max_bytes limit */ - if (m > max_bytes) - m = max_bytes; - } + if (max_bytes != UINT64_MAX && m > max_bytes) + m = max_bytes; /* First try copy_file_range(), unless we already tried */ if (try_cfr) {