mirror of
https://github.com/troglobit/finit.git
synced 2026-11-02 13:20:32 +00:00
Followup to tempfile(): paranoid umask as well ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
162b394726
commit
3d0e58ebcd
1 file changed
+3
@@ -138,9 +138,12 @@ int atonum(char *str)
|
|||||||
FILE *tempfile(void)
|
FILE *tempfile(void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
mode_t oldmask;
|
||||||
char *template = "/tmp/finit.XXXXXX";
|
char *template = "/tmp/finit.XXXXXX";
|
||||||
|
|
||||||
|
oldmask = umask(0077);
|
||||||
fd = mkstemp(template);
|
fd = mkstemp(template);
|
||||||
|
umask(oldmask);
|
||||||
if (-1 == fd)
|
if (-1 == fd)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user