remove unused return variable,
The errno will throw by virReportSystemError
Signed-off-by: Yi Li <yili(a)winhong.com>
---
src/storage/storage_util.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 6fc8597733..c6d0f7a97c 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -307,7 +307,6 @@ createRawFile(int fd, virStorageVolDefPtr vol,
bool reflink_copy)
{
bool need_alloc = true;
- int ret = 0;
unsigned long long pos = 0;
/* If the new allocation is lower than the capacity of the original file,
@@ -319,11 +318,10 @@ createRawFile(int fd, virStorageVolDefPtr vol,
/* Seek to the final size, so the capacity is available upfront
* for progress reporting */
if (ftruncate(fd, vol->target.capacity) < 0) {
- ret = -errno;
virReportSystemError(errno,
_("cannot extend file '%s'"),
vol->target.path);
- return ret;
+ return -1;
}
/* Avoid issues with older kernel's <linux/fs.h> namespace pollution. */
@@ -339,11 +337,10 @@ createRawFile(int fd, virStorageVolDefPtr vol,
if (fallocate(fd, 0, 0, vol->target.allocation) == 0) {
need_alloc = false;
} else if (errno != ENOSYS && errno != EOPNOTSUPP) {
- ret = -errno;
virReportSystemError(errno,
_("cannot allocate %llu bytes in file
'%s'"),
vol->target.allocation, vol->target.path);
- return ret;
+ return -1;
}
}
#endif
@@ -353,9 +350,9 @@ createRawFile(int fd, virStorageVolDefPtr vol,
/* allow zero blocks to be skipped if we've requested sparse
* allocation (allocation < capacity) or we have already
* been able to allocate the required space. */
- if ((ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain,
- !need_alloc, reflink_copy)) < 0)
- return ret;
+ if (virStorageBackendCopyToFD(vol, inputvol, fd, &remain,
+ !need_alloc, reflink_copy) < 0)
+ return -1;
/* If the new allocation is greater than the original capacity,
* but fallocate failed, fill the rest with zeroes.
@@ -365,21 +362,19 @@ createRawFile(int fd, virStorageVolDefPtr vol,
if (need_alloc && (vol->target.allocation - pos > 0)) {
if (safezero(fd, pos, vol->target.allocation - pos) < 0) {
- ret = -errno;
virReportSystemError(errno, _("cannot fill file '%s'"),
vol->target.path);
- return ret;
+ return -1;
}
}
if (g_fsync(fd) < 0) {
- ret = -errno;
virReportSystemError(errno, _("cannot sync data to file
'%s'"),
vol->target.path);
- return ret;
+ return -1;
}
- return ret;
+ return 0;
}
static int
--
2.25.3