1 Create better temporary files.
3 Probably-Signed-off-by: Dave Bender <bender@benegon.com>
4 [yann.morin.1998@free.fr: patch was made by Dave, but he
5 forgot his SoB line, so I added it; split the patch in two
7 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
9 diff -rupN cgic206/cgic.c cgic206_tempfile/cgic.c
10 --- cgic206/cgic.c 2014-03-16 18:17:11.000000000 -0400
11 +++ cgic206_tempfile/cgic.c 2015-01-21 11:58:45.436384908 -0500
14 #endif /* CGICDEBUG */
33 #define cgiStrEq(a, b) (!strcmp((a), (b)))
34 @@ -636,16 +638,17 @@ static cgiParseResultType getTempFileNam
35 window between the file's creation and the
36 chmod call (glibc 2.0.6 and lower might
37 otherwise have allowed this). */
40 + umode = umask(0600);
41 strcpy(tfileName, cgicTempDir "/cgicXXXXXX");
42 - outfd = mkstemp(tfileName);
43 + outfd = mkostemp(tfileName, O_CLOEXEC | O_NOATIME);
49 - /* Fix the permissions */
50 - if (chmod(tfileName, 0600) != 0) {