dd: exit with 1 if last write was incomplete
$ busybox dd if=/dev/zero of=/dev/loop0 bs=100M count=8; echo $? 8+0 records in 7+1 records out 805220352 bytes (767.9MB) copied, 0.464010 seconds, 1.6GB/s 1 <=========== FIXED function old new delta write_and_stats 96 97 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
d1df1a709f
commit
5afd63a631
1 changed files with 7 additions and 5 deletions
|
@ -195,15 +195,17 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
|
||||||
ssize_t n = full_write_or_warn(buf, len, filename);
|
ssize_t n = full_write_or_warn(buf, len, filename);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if ((size_t)n == obs)
|
|
||||||
G.out_full++;
|
|
||||||
else if (n) /* > 0 */
|
|
||||||
G.out_part++;
|
|
||||||
#if ENABLE_FEATURE_DD_THIRD_STATUS_LINE
|
#if ENABLE_FEATURE_DD_THIRD_STATUS_LINE
|
||||||
G.total_bytes += n;
|
G.total_bytes += n;
|
||||||
#endif
|
#endif
|
||||||
|
if ((size_t)n == obs) {
|
||||||
|
G.out_full++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (n) /* > 0 */
|
||||||
|
G.out_part++;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#if ENABLE_LFS
|
#if ENABLE_LFS
|
||||||
# define XATOU_SFX xatoull_sfx
|
# define XATOU_SFX xatoull_sfx
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue