1
1

Ticket #82 (savannah: "save as" retains mode) patch by imdagger

Consider following scenario:
$ touch /tmp/foo_file
$ chmod 0444 /tmp/foo_file # readonly for owner
$ mcedit /tmp/foo_file
> 1. edit
> 2. try to save, fail. choose another name: /tmp/foo_file2
> 3. edit
> 4. try to save, fail again!

This patch adds owner write permissions for files, created in
step 2.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
Этот коммит содержится в:
Sergei Trofimovich 2009-08-09 19:05:52 +03:00
родитель 96c0dc08d8
Коммит 65771004c4

Просмотреть файл

@ -497,6 +497,15 @@ edit_save_as_cmd (WEdit *edit)
save_lock = edit_lock_file (exp);
}
if (different_filename)
{
/*
* Allow user to write into saved (under another name) file
* even if original file had r/o user permissions.
*/
edit->stat1.st_mode |= S_IWRITE;
}
rv = edit_save_file (edit, exp);
switch (rv) {
case 1: