forked from enlightenment/efl
eina: And guard the right function with umask
Thanks Cedric.
This commit is contained in:
parent
bd5a5e7fce
commit
0b26b1bd89
|
@ -878,15 +878,16 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path)
|
|||
tmpdir = (char *)evil_tmpdir_get();
|
||||
#endif /* ! HAVE_EVIL */
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename);
|
||||
|
||||
/*
|
||||
* Make sure temp file is created with secure permissions,
|
||||
* http://man7.org/linux/man-pages/man3/mkstemp.3.html#NOTES
|
||||
*/
|
||||
old_umask = umask(0077);
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename);
|
||||
fd = mkstemp(buffer);
|
||||
umask(old_umask);
|
||||
|
||||
fd = mkstemp(buffer);
|
||||
if (path) *path = eina_tmpstr_add(buffer);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue