[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/6] block/raw-posix: Fix preallocating write() loop
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 4/6] block/raw-posix: Fix preallocating write() loop |
Date: |
Tue, 18 Nov 2014 12:35:06 +0100 |
From: Max Reitz <address@hidden>
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 <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/raw-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 414e6d1..e0e48c5 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1451,7 +1451,7 @@ static int raw_create(const char *filename, QemuOpts
*opts, Error **errp)
"Could not write to the new file");
break;
}
- left -= num;
+ left -= result;
}
fsync(fd);
g_free(buf);
--
1.8.3.1
- [Qemu-devel] [PULL 0/6] Block patches for 2.2.0-rc2, Kevin Wolf, 2014/11/18
- [Qemu-devel] [PULL 1/6] raw-posix: Fix comment for raw_co_get_block_status(), Kevin Wolf, 2014/11/18
- [Qemu-devel] [PULL 2/6] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP, Kevin Wolf, 2014/11/18
- [Qemu-devel] [PULL 3/6] raw-posix: The SEEK_HOLE code is flawed, rewrite it, Kevin Wolf, 2014/11/18
- [Qemu-devel] [PULL 5/6] block/raw-posix: Only sync after successful preallocation, Kevin Wolf, 2014/11/18
- [Qemu-devel] [PULL 4/6] block/raw-posix: Fix preallocating write() loop,
Kevin Wolf <=
- [Qemu-devel] [PULL 6/6] block/raw-posix: Catch fsync() errors, Kevin Wolf, 2014/11/18
- Re: [Qemu-devel] [PULL 0/6] Block patches for 2.2.0-rc2, Peter Maydell, 2014/11/18