From 49532ac8344b6e612ee243763536c857ebfb09f7 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 21 Mar 2012 17:02:43 +0300 Subject: [PATCH] Ticket #2755: cannot copy zero-length files with [Preallocate space] option If [Preallocate space] option is enabled, MC can't copy zero-length files: "Cannot preallocate space for target file ... Invalid argument (22)" Signed-off-by: Slava Zanko --- lib/vfs/vfs.c | 3 +++ 1 file changed, 3 insertions(+) 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 */ -- 2.11.4.GIT