mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
block/raw-posix: Only sync after successful preallocation
The loop which filled the file with zeroes may have been left early due to an error. In that case, the fsync() should be skipped. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
39411cf3c3
commit
731de38052
1 changed files with 3 additions and 1 deletions
|
@ -1453,7 +1453,9 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
|
|||
}
|
||||
left -= result;
|
||||
}
|
||||
fsync(fd);
|
||||
if (result >= 0) {
|
||||
fsync(fd);
|
||||
}
|
||||
g_free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue