diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2012-03-27 16:54:22 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2012-03-27 16:54:22 +0000 |
commit | 2ed54f1d421924d456b973016000380cdf238259 (patch) | |
tree | 37182e835848411f549856a7859762ac78abfa45 /app-misc/mc/files | |
parent | Adding findsmb script when smbclient use flag is enabled, bug 406033 (diff) | |
download | gentoo-2-2ed54f1d421924d456b973016000380cdf238259.tar.gz gentoo-2-2ed54f1d421924d456b973016000380cdf238259.tar.bz2 gentoo-2-2ed54f1d421924d456b973016000380cdf238259.zip |
Fix bug #409365 by Marcin Mirosław (broken permissions when attempt to save file on top of directory). Patch picked from upstream.
(Portage version: 2.2.0_alpha91/cvs/Linux x86_64)
Diffstat (limited to 'app-misc/mc/files')
-rw-r--r-- | app-misc/mc/files/mc-4.8.2-fix-existing.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app-misc/mc/files/mc-4.8.2-fix-existing.patch b/app-misc/mc/files/mc-4.8.2-fix-existing.patch new file mode 100644 index 000000000000..fbb1e6fba3b0 --- /dev/null +++ b/app-misc/mc/files/mc-4.8.2-fix-existing.patch @@ -0,0 +1,38 @@ +commit 2a5885fb7f5ce7af3576fa17ce697adbd9b61567 +Author: Slava Zanko <slavazanko@gmail.com> +Date: Fri Mar 23 13:40:25 2012 +0300 + + Ticket #2761: save file on top of existing directory changes dir's permissions + + Steps to reproduce: + + mkdir foo + chmod 0700 foo + mcedit bar + ls -ld foo + drw-r--r-- 1 slyfox users 0 Mar 22 22:10 foo + + We've lost dir's permissions. + + Signed-off-by: Slava Zanko <slavazanko@gmail.com> + +diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c +index 8e6c9a9..d52e48b 100644 +--- a/src/editor/editcmd.c ++++ b/src/editor/editcmd.c +@@ -1488,6 +1488,15 @@ edit_save_as_cmd (WEdit * edit) + if (vfs_path_cmp (edit->filename_vpath, exp_vpath) != 0) + { + int file; ++ struct stat sb; ++ ++ if (mc_stat (exp_vpath, &sb) == 0 && !S_ISREG (sb.st_mode)) ++ { ++ edit_error_dialog (_("Save as"), ++ get_sys_error (_ ++ ("Cannot save: destination is not a regular file"))); ++ goto ret; ++ } + + different_filename = 1; + file = mc_open (exp_vpath, O_RDONLY | O_BINARY); |