From 88d61573230b09d2c23bb5d25ebf0adfa3ba9e2b Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 19 Aug 2018 11:52:30 +0300 Subject: [PATCH] (vfs_preallocate): check mc_global.vfs.preallocate_space before call. Signed-off-by: Andrew Borodin --- lib/vfs/vfs.c | 3 --- src/filemanager/file.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/vfs/vfs.c b/lib/vfs/vfs.c index ea58c2f32..5093e4293 100644 --- a/lib/vfs/vfs.c +++ b/lib/vfs/vfs.c @@ -650,9 +650,6 @@ vfs_preallocate (int dest_vfs_fd, off_t src_fsize, off_t dest_fsize) void *dest_fd = NULL; struct vfs_class *dest_class; - if (!mc_global.vfs.preallocate_space) - return 0; - if (src_fsize == 0) return 0; diff --git a/src/filemanager/file.c b/src/filemanager/file.c index 937d43d77..ceea4d4fd 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -2367,7 +2367,8 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx, } /* try preallocate space; if fail, try copy anyway */ - while (vfs_preallocate (dest_desc, file_size, appending ? dst_stat.st_size : 0) != 0) + while (mc_global.vfs.preallocate_space && + vfs_preallocate (dest_desc, file_size, appending ? dst_stat.st_size : 0) != 0) { if (ctx->skip_all) {