summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2007-01-12 17:10:16 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-01-13 16:56:02 +0000
commitb0b546b3f9cbdb839276fcb570321d9f1a7bcd3b (patch)
tree1191336978ebb4582cda16d7ce0d0cda9fae1eac /pp_sys.c
parent8efd9ba483b3f64a0cb911a666d3b6109b1c6ea6 (diff)
downloadperl-b0b546b3f9cbdb839276fcb570321d9f1a7bcd3b.tar.gz
Re: AW: umask handling in File::Temp
Message-ID: <877ivs1dt3.fsf@ask.g.aas.no> p4raw-id: //depot/perl@29784
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index ca2a110b13..974f32af26 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);