diff --git a/block/file-posix.c b/block/file-posix.c index a2f6d8a8c85193dc49decfb5691d1ff7834e5122..3794c0007aba5a405b146ca67c85507536b3069d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1701,6 +1701,7 @@ static int raw_regular_truncate(int fd, int64_t offset, PreallocMode prealloc, case PREALLOC_MODE_FULL: { int64_t num = 0, left = offset - current_length; + off_t seek_result; /* * Knowing the final size from the beginning could allow the file @@ -1715,8 +1716,8 @@ static int raw_regular_truncate(int fd, int64_t offset, PreallocMode prealloc, buf = g_malloc0(65536); - result = lseek(fd, current_length, SEEK_SET); - if (result < 0) { + seek_result = lseek(fd, current_length, SEEK_SET); + if (seek_result < 0) { result = -errno; error_setg_errno(errp, -result, "Failed to seek to the old end of file");