nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 65321f92340c164f8eaeaad178f8226fd963a060
parent bde8858a3a68a377328e6519dcf4262c4316b2e1
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 14 Jul 2020 15:19:50 +0200

files: do not make a failsafe backup when in restricted mode

When in restricted mode, nano should not write to any other file
than to the ones mentioned on the command line.

Diffstat:
MNEWS | 2+-
Msrc/files.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS @@ -1,4 +1,4 @@ -2020.05.23 - GNU nano 4.9.3 "Almendras" +s2020.05.23 - GNU nano 4.9.3 "Almendras" • One more bug introduced in version 4.9 is fixed: a crash when the terminal screen is resized while at a lock-file prompt. diff --git a/src/files.c b/src/files.c @@ -1797,7 +1797,7 @@ bool write_file(const char *name, FILE *thefile, bool tmp, /* When the user requested a backup, we do this only if the file exists and * isn't temporary AND the file has not been modified by someone else since * we opened it (or we are appending/prepending or writing a selection). */ - if (is_existing_file && openfile->statinfo && + if (is_existing_file && !ISSET(RESTRICTED) && openfile->statinfo && (openfile->statinfo->st_mtime == st.st_mtime || method != OVERWRITE || openfile->mark)) { if (!backup_file(realname, &backupname))