diff --git a/lib/vfs/vfs.c b/lib/vfs/vfs.c index 3b1061cb1..0a0e7a626 100644 --- a/lib/vfs/vfs.c +++ b/lib/vfs/vfs.c @@ -645,6 +645,9 @@ vfs_preallocate (int dest_vfs_fd, off_t src_fsize, off_t dest_fsize) if (dest_fd == NULL) return 0; + if (src_fsize == 0) + return 0; + return posix_fallocate (*dest_fd, dest_fsize, src_fsize - dest_fsize); #endif /* HAVE_POSIX_FALLOCATE */