summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-23 18:26:58 +0100
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit68aea2470f0eaf69e32a74b0734074936b63c977 (patch)
tree446fbb749dedeb9af04db156fb1f3906aa53d1f5 /src
parentab959b08aaa808f4b2b48295e06e3eb103600958 (diff)
copy: reduce number of checks
We check max_bytes twice here, let's simplify that, and reduce one level of indentation.
Diffstat (limited to 'src')
-rw-r--r--src/basic/copy.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/basic/copy.c b/src/basic/copy.c
index 7d46f5678..d008204a4 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -171,13 +171,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) {