nano

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

commit b48dfde3b2a3160f56d9db8dfe604c48203a2ff5
parent f8366cd5c954e09c65957e46cfbaffe7da6b9662
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 26 May 2020 13:40:11 +0200

files: remove two superfluous calls for shielding temp files from others

If there are still systems where mkstemp() creates world-readable
temporary files, then please holler.  On current BSDs and on GNU,
I've verified that mkstemp() creates files with 0600 permissions.

Diffstat:
Msrc/files.c | 5-----
1 file changed, 0 insertions(+), 5 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -1398,7 +1398,6 @@ char *safe_tempfile(FILE **stream) { const char *env_dir = getenv("TMPDIR"); char *tempdir = NULL, *tempfile_name = NULL; - mode_t was_mask; int fd; /* Get the absolute path for the first directory among $TMPDIR @@ -1415,12 +1414,8 @@ char *safe_tempfile(FILE **stream) tempfile_name = charealloc(tempdir, strlen(tempdir) + 12); strcat(tempfile_name, "nano.XXXXXX"); - was_mask = umask(S_IRWXG | S_IRWXO); - fd = mkstemp(tempfile_name); - umask(was_mask); - if (fd == -1) { free(tempfile_name); return NULL;