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 <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2012-03-21 17:02:43 +03:00
parent e72a46acf9
commit 49532ac834

View File

@ -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 */