mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
build: fix build without posix_fallocate
Such as on FreeBSD. Broken in commit aa2a4cff7. * src/util/virstoragefile.c (virStorageFileResize): Add missing ';', mark conditionally unused variables. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
922ebe4ead
commit
e90a3598c7
@ -1048,9 +1048,12 @@ virStorageFileResize(const char *path,
|
||||
{
|
||||
int fd = -1;
|
||||
int ret = -1;
|
||||
int rc;
|
||||
off_t offset = orig_capacity;
|
||||
off_t len = capacity - orig_capacity;
|
||||
int rc ATTRIBUTE_UNUSED;
|
||||
off_t offset ATTRIBUTE_UNUSED;
|
||||
off_t len ATTRIBUTE_UNUSED;
|
||||
|
||||
offset = orig_capacity;
|
||||
len = capacity - orig_capacity;
|
||||
|
||||
if ((fd = open(path, O_RDWR)) < 0) {
|
||||
virReportSystemError(errno, _("Unable to open '%s'"), path);
|
||||
@ -1068,13 +1071,13 @@ virStorageFileResize(const char *path,
|
||||
#elif HAVE_SYS_SYSCALL_H && defined(SYS_fallocate)
|
||||
if (syscall(SYS_fallocate, fd, 0, offset, len) != 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to preallocate space for "
|
||||
_("Failed to pre-allocate space for "
|
||||
"file '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
#else
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("preallocate is not supported on this platform"))
|
||||
_("preallocate is not supported on this platform"));
|
||||
goto cleanup;
|
||||
#endif
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user