efreet: Set umask before creating temporary file

CID 1039615
This commit is contained in:
Sebastian Dransfeld 2013-10-14 13:20:44 +02:00
parent 67a8feeb08
commit e2dabc5d23
1 changed files with 4 additions and 0 deletions

View File

@ -28,13 +28,17 @@ main(int argc, char *argv[])
{ {
char path[PATH_MAX]; char path[PATH_MAX];
FILE *log; FILE *log;
mode_t um;
strcpy(path, "/tmp/efreetd_XXXXXX"); strcpy(path, "/tmp/efreetd_XXXXXX");
um = umask(0077);
if (mkstemp(path) < 0) if (mkstemp(path) < 0)
{ {
perror("mkstemp"); perror("mkstemp");
umask(um);
return 1; return 1;
} }
umask(um);
if (chmod(path, 0700) < 0) if (chmod(path, 0700) < 0)
{ {
perror("chmod"); perror("chmod");