diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-01-10 11:04:09 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-01-10 11:04:09 +0100 |
commit | 2c876774a90ddb7478937ead096937f64e6bd7ec (patch) | |
tree | e3cb74f7e6a1bf304dc1d1f993d081b34478ef17 | |
parent | 5afd63a631f49112ac305ea1532dd226e9c39d12 (diff) | |
download | busybox-w32-2c876774a90ddb7478937ead096937f64e6bd7ec.tar.gz busybox-w32-2c876774a90ddb7478937ead096937f64e6bd7ec.tar.bz2 busybox-w32-2c876774a90ddb7478937ead096937f64e6bd7ec.zip |
dd: fixed partial count logic
$ busybox dd if=/dev/zero of=/dev/loop0 bs=100M count=8; echo $?
8+0 records in
7+0 records out <=========== FIXED, was 7+1
805220352 bytes (767.9MB) copied, 0.464010 seconds, 1.6GB/s
1
function old new delta
write_and_stats 97 99 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/dd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 9d173cc13..38b2a6aa1 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -202,8 +202,10 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs, | |||
202 | G.out_full++; | 202 | G.out_full++; |
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | if (n) /* > 0 */ | 205 | if ((size_t)n == len) { |
206 | G.out_part++; | 206 | G.out_part++; |
207 | return 0; | ||
208 | } | ||
207 | return 1; | 209 | return 1; |
208 | } | 210 | } |
209 | 211 | ||