From 7ac669c654411bf9a05e613bb9502d909b76f0bd Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 28 Jul 2018 17:21:24 +0300 Subject: [PATCH] Ticket: 3908: quiet single file overwrite. If target file exists, MC overwrites that file without confirmation. The bug has not been fixed comletely in 7d73ce1cbe5e009018df6ec6776de258f71673b1. Yet another test case: 1. Create files: mkdir -p test1/1 test2/1 echo "1" > test1/1/file echo "2" > test2/1/file 2. Run `mc test1 test2`. 3. Select directory "1" and press F6. Result: "file" file is overwritten w/o confirmation. Expected result: since the "file" file exists the confirmation dialog must be shown. The problem is: confirmation dialog requires context UI which was not created in case of single directory move/rename operation. Signed-off-by: Andrew Borodin --- src/filemanager/file.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/filemanager/file.c b/src/filemanager/file.c index 391de0643..9f4683a10 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -1940,15 +1940,13 @@ operate_single_file (const WPanel * panel, FileOperation operation, file_op_tota break; case OP_MOVE: - if (is_file) - { #ifdef ENABLE_BACKGROUND - /* create UI to show confirmation dialog */ - if (!mc_global.we_are_background) - file_op_context_create_ui (ctx, TRUE, FILEGUI_DIALOG_ONE_ITEM); + /* create UI to show confirmation dialog */ + if (!mc_global.we_are_background) + file_op_context_create_ui (ctx, TRUE, FILEGUI_DIALOG_ONE_ITEM); #endif + if (is_file) value = move_file_file (panel, tctx, ctx, src, dest); - } else value = do_move_dir_dir (panel, tctx, ctx, src, dest); break;