From: Colin Clark Date: Sun, 2 Feb 2020 12:31:53 +0000 (+0000) Subject: Fix #741: Crash when creating new dir with same name as already existing file X-Git-Tag: v1.6~93 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=ee5cc947e0605932eb141f42e06b2ff1dc3d1b4e Fix #741: Crash when creating new dir with same name as already existing file https://github.com/BestImageViewer/geeqie/issues/741 Check if destination exists before executing command --- diff --git a/src/utilops.c b/src/utilops.c index 1614a400..f1824c9c 100644 --- a/src/utilops.c +++ b/src/utilops.c @@ -787,14 +787,21 @@ static void file_util_perform_ci_dir(UtilityData *ud, gboolean internal, gboolea GList *work; g_assert(ud->dir_fd->sidecar_files == NULL); // directories should not have sidecars - if ((internal && file_data_sc_perform_ci(ud->dir_fd)) || - (!internal && ext_result)) + if (isdir(ud->dest_path)) { - file_data_sc_apply_ci(ud->dir_fd); + fail = file_data_ref(ud->dir_fd); } else { - fail = file_data_ref(ud->dir_fd); + if ((internal && file_data_sc_perform_ci(ud->dir_fd)) || + (!internal && ext_result)) + { + file_data_sc_apply_ci(ud->dir_fd); + } + else + { + fail = file_data_ref(ud->dir_fd); + } }