From: Gisle Aas Date: Fri, 12 Jan 2007 16:10:16 +0000 (+0100) Subject: Re: AW: umask handling in File::Temp X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b0b546b3f9cbdb839276fcb570321d9f1a7bcd3b;p=p5sagit%2Fp5-mst-13.2.git Re: AW: umask handling in File::Temp Message-ID: <877ivs1dt3.fsf@ask.g.aas.no> p4raw-id: //depot/perl@29784 --- diff --git a/pp_sys.c b/pp_sys.c index ca2a110..974f32a 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -707,8 +707,12 @@ PP(pp_umask) Mode_t anum; if (MAXARG < 1) { - anum = PerlLIO_umask(0); - (void)PerlLIO_umask(anum); + anum = PerlLIO_umask(022); + /* setting it to 022 between the two calls to umask avoids + * to have a window where the umask is set to 0 -- meaning + * that another thread could create world-writeable files. */ + if (anum != 022) + (void)PerlLIO_umask(anum); } else anum = PerlLIO_umask(POPi);