mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lib: Use compound initialization for buffer in disk creation
Signed-off-by: Susant Sahani <ssahani@redhat.com>
This commit is contained in:
committed by
Richard W.M. Jones
parent
cf6ac9aeba
commit
3aaaf4f667
@@ -202,13 +202,11 @@ disk_create_raw (guestfs_h *g, const char *filename, int64_t size,
|
||||
}
|
||||
#else
|
||||
/* Slow emulation of posix_fallocate on platforms which don't have it. */
|
||||
char buffer[BUFSIZ];
|
||||
char buffer[BUFSIZ] = {0};
|
||||
size_t remaining = size;
|
||||
size_t n;
|
||||
ssize_t r;
|
||||
|
||||
memset (buffer, 0, sizeof buffer);
|
||||
|
||||
while (remaining > 0) {
|
||||
n = remaining > sizeof buffer ? sizeof buffer : remaining;
|
||||
r = write (fd, buffer, n);
|
||||
|
||||
Reference in New Issue
Block a user