mirror of
git://git.sv.gnu.org/nano.git
synced 2025-02-12 19:34:18 +03:00
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.
This commit is contained in:
parent
f8366cd5c9
commit
b48dfde3b2
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user