diff options
author | Karl Williamson <khw@cpan.org> | 2020-03-15 22:17:32 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-03-18 18:12:39 -0600 |
commit | d848c629501c573e92befef804a2ebd1d7bd3def (patch) | |
tree | 6ce7868add5a24462355a750ad59327fc07d2191 /util.c | |
parent | 133a66aff08799249b0b2cd73d7236402fa94870 (diff) | |
download | perl-d848c629501c573e92befef804a2ebd1d7bd3def.tar.gz |
Perl_init_tm: Use mutex to avoid race.
This locks around localtime (and localtime_r which this call may be
translated into) which are sensitive to locale and environment changes
in their execution.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -3637,9 +3637,11 @@ Perl_init_tm(pTHX_ struct tm *ptm) /* see mktime, strftime and asctime */ PERL_UNUSED_CONTEXT; PERL_ARGS_ASSERT_INIT_TM; (void)time(&now); + ENV_LOCALE_READ_LOCK; my_tm = localtime(&now); if (my_tm) Copy(my_tm, ptm, 1, struct tm); + ENV_LOCALE_READ_UNLOCK; #else PERL_UNUSED_CONTEXT; PERL_ARGS_ASSERT_INIT_TM; |