From: Denys Vlasenko Date: Wed, 10 Jan 2018 10:04:09 +0000 (+0100) Subject: dd: fixed partial count logic X-Git-Tag: 1_29_0~384 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2c876774a90ddb7478937ead096937f64e6bd7ec;p=oweals%2Fbusybox.git 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 --- 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, G.out_full++; return 0; } - if (n) /* > 0 */ + if ((size_t)n == len) { G.out_part++; + return 0; + } return 1; }