block/raw-posix: Fix preallocating write() loop
commit39411cf3c316de0fe3cbb9585774bacfe3bd8efd
authorMax Reitz <mreitz@redhat.com>
Tue, 18 Nov 2014 10:23:04 +0000 (18 11:23 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 Nov 2014 11:08:59 +0000 (18 12:08 +0100)
treea63dda7bee86b7377056493dcbe6e837f035f135
parent867678530240ed7a4aaf647df08be98bebd3b1f0
block/raw-posix: Fix preallocating write() loop

write() may write less bytes than requested; in this case, the number of
bytes written is returned. This is the byte count we should be
subtracting from the number of bytes still to be written, and not the
byte count we requested to write.

Reported-by: László Érsek <lersek@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/raw-posix.c