dd: fix handling of short result of full_write(), closes 11711

$ dd bs=1G <sda1 of=/dev/sda1
dd: error writing '/dev/sda1': No space left on device
1+0 records in
0+0 records out
999292928 bytes (953.0MB) copied, 0.784617 seconds, 1.2GB/s

function                                             old     new   delta
write_and_stats                                       99     102      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2019-05-14 17:46:18 +02:00
parent 8c317f03f6
commit 875ce094cf
2 changed files with 15 additions and 14 deletions

View File

@ -11,7 +11,8 @@
/*
* Write all of the supplied buffer out to a file.
* This does multiple writes as necessary.
* Returns the amount written, or -1 on an error.
* Returns the amount written, or -1 if error was seen
* on the very first write.
*/
ssize_t FAST_FUNC full_write(int fd, const void *buf, size_t len)
{