summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2017-11-29 07:24:50 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2017-11-29 11:03:48 +0200
commit026633c6d8d2f9ba22e5de49b50579c768369e5e (patch)
treec37099f2b1213d07fb4d60deae1f561192c60a13 /doio.c
parent8843856e9716655549cce789b3338e1d4c72fffb (diff)
downloadperl-026633c6d8d2f9ba22e5de49b50579c768369e5e.tar.gz
Set safer umask for mkstemp().
Coverity #169258.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 7dcbbb5cfb..d985b79b4b 100644
--- a/doio.c
+++ b/doio.c
@@ -850,7 +850,11 @@ S_openindirtemp(pTHX_ GV *gv, SV *orig_name, SV *temp_out_name) {
else
sv_setpvs(temp_out_name, "XXXXXXXX");
- fd = Perl_my_mkstemp(SvPVX(temp_out_name));
+ {
+ int old_umask = umask(0177);
+ fd = Perl_my_mkstemp(SvPVX(temp_out_name));
+ umask(old_umask);
+ }
if (fd < 0)
return FALSE;