fix broken directory copying, backport from upstream (#624973)

This commit is contained in:
Jindrich Novy 2010-09-02 11:10:42 +02:00
parent a91b1dae39
commit bca2c47c05
2 changed files with 44 additions and 1 deletions

38
mc-dircopying.patch Normal file
View File

@ -0,0 +1,38 @@
diff --git a/src/file.c b/src/file.c
index d7eaa46..5c45dcf 100644
--- a/src/file.c
+++ b/src/file.c
@@ -2066,28 +2066,21 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
dest_dir = other_panel->cwd;
else
dest_dir = panel->cwd;
-
/*
* Add trailing backslash only when do non-local ops.
* It saves user from occasional file renames (when destination
* dir is deleted)
*/
- if (force_single || dest_dir[0] == '\0')
- {
- /* just copy */
- dest_dir_ = g_strdup (dest_dir);
- }
- else if (single_entry)
+ if (!force_single && dest_dir[0] != '\0' && dest_dir[strlen (dest_dir) - 1] != PATH_SEP)
{
- /* add filename to dest path */
- dest_dir_ = g_build_filename (dest_dir, source, (char *) NULL);
+ /* add trailing separator */
+ dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR, (char *) NULL);
}
else
{
- /* add trailing separator */
- dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR, (char *) NULL);
+ /* just copy */
+ dest_dir_ = g_strdup (dest_dir);
}
-
if (dest_dir_ == NULL)
{
file_op_total_context_destroy (tctx);

View File

@ -1,7 +1,7 @@
Summary: User-friendly text console file manager and visual shell
Name: mc
Version: 4.7.3
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
License: GPLv2
Group: System Environment/Shells
@ -15,6 +15,7 @@ Requires: dev >= 3.3-3
Patch0: mc-extensions.patch
Patch1: mc-mcviewsegfault.patch
Patch2: mc-achownsegfault.patch
Patch3: mc-dircopying.patch
%description
Midnight Commander is a visual shell much like a file manager, only
@ -28,6 +29,7 @@ specific files.
%patch0 -p1 -b .extensions
%patch1 -p1 -b .mcviewsegfault
%patch2 -p1 -b .achownsegfault
%patch3 -p1 -b .dircopying
%build
export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS"
@ -89,6 +91,9 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_libexecdir}/mc/extfs.d
%changelog
* Thu Sep 2 2010 Jindrich Novy <jnovy@redhat.com> 4.7.3-3
- fix broken directory copying, backport from upstream (#624973)
* Wed Sep 1 2010 Jindrich Novy <jnovy@redhat.com> 4.7.3-2
- fix segfault in advanced chown dialog (#625801)