From c626f5fdcc9387b6f445948fa4a41ec0d3890371 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 6 Nov 2002 18:09:40 +0000 Subject: [PATCH] * editcmd.c (edit_save_file): Restore ownership before access mode, not after. Otherwise suid bit is lost. Reported by Nerijus Baliunas --- edit/ChangeLog | 6 ++++++ edit/editcmd.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index 2b5dff414..39d3b3665 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,9 @@ +2002-11-06 Pavel Roskin + + * editcmd.c (edit_save_file): Restore ownership before access + mode, not after. Otherwise suid bit is lost. + Reported by Nerijus Baliunas + 2002-10-30 Pavel Roskin * edit.c: Include charset.h unconditionally, use new conversion diff --git a/edit/editcmd.c b/edit/editcmd.c index 51a1c06be..c77e27819 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -229,8 +229,8 @@ int edit_save_file (WEdit * edit, const char *filename) } else savename = g_strdup (filename); - mc_chmod (savename, edit->stat1.st_mode); mc_chown (savename, edit->stat1.st_uid, edit->stat1.st_gid); + mc_chmod (savename, edit->stat1.st_mode); if ((fd = mc_open (savename, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY , edit->stat1.st_mode)) == -1)