As Perl_get_arena() is dealing with sizes, use size_t rather than int,
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index ca2a110..974f32a 100644 (file)
--- 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);