public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-misc/mc/files: mc-4.8.2-fix-existing.patch
@ 2012-03-27 16:54 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; only message in thread
From: Sergei Trofimovich (slyfox) @ 2012-03-27 16:54 UTC (permalink / raw
  To: gentoo-commits

slyfox      12/03/27 16:54:22

  Added:                mc-4.8.2-fix-existing.patch
  Log:
  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)

Revision  Changes    Path
1.1                  app-misc/mc/files/mc-4.8.2-fix-existing.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/mc/files/mc-4.8.2-fix-existing.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/mc/files/mc-4.8.2-fix-existing.patch?rev=1.1&content-type=text/plain

Index: mc-4.8.2-fix-existing.patch
===================================================================
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);






^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-27 16:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27 16:54 [gentoo-commits] gentoo-x86 commit in app-misc/mc/files: mc-4.8.2-fix-existing.patch Sergei Trofimovich (slyfox)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox