1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix mkstemp(3) creating files with an insecure mode.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-08-20 01:15:24 +02:00
parent 74fbbb3c78
commit b75678bcab

View file

@ -43,7 +43,7 @@ extern "C" int mkstemp(char* templ)
{ {
for ( size_t i = templ_length - 6; i < templ_length; i++ ) for ( size_t i = templ_length - 6; i < templ_length; i++ )
templ[i] = '0' + rand() % 10; templ[i] = '0' + rand() % 10;
} while ( (fd = open(templ, O_RDWR | O_EXCL | O_CREAT, 0666)) < 0 && } while ( (fd = open(templ, O_RDWR | O_EXCL | O_CREAT, 0600)) < 0 &&
(errno == EEXIST) ); (errno == EEXIST) );
return fd; return fd;