summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-04-01 16:36:52 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-04-01 16:36:52 +0000
commit05404ffef2713f4c61b42355c2a2ce1a95343c33 (patch)
tree0a0655bca7f94bda75941a7220ae39438233ae79 /pp.c
parent12724655a0993f91aa01e1070345dfd5a3d78ed1 (diff)
downloadperl-05404ffef2713f4c61b42355c2a2ce1a95343c33.tar.gz
Integrate:
[ 19119] Address "5.8.1@19053: crypt_r() takes 128K per thread". p4raw-link: @19119 on //depot/maint-5.8/perl: 5338c2bbd71426ba96ace22615fafeda3d05e36d p4raw-link: @19053 on //depot/maint-5.8/perl: dab75801826d3b09804fff099d3631e91578dcd1 p4raw-id: //depot/perl@19122 p4raw-integrated: from //depot/maint-5.8/perl@19121 'copy in' reentr.c reentr.h reentr.pl (@19106..) 'merge in' pp.c (@19045..)
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 37277e4f11..524ed243fa 100644
--- a/pp.c
+++ b/pp.c
@@ -3418,6 +3418,24 @@ PP(pp_crypt)
sv_utf8_downgrade(tsv, FALSE);
tmps = SvPVX(tsv);
}
+# ifdef USE_ITHREADS
+# ifdef HAS_CRYPT_R
+ if (!PL_reentrant_buffer->_crypt_struct_buffer) {
+ /* This should be threadsafe because in ithreads there is only
+ * one thread per interpreter. If this would not be true,
+ * we would need a mutex to protect this malloc. */
+ PL_reentrant_buffer->_crypt_struct_buffer =
+ (struct crypt_data *)safemalloc(sizeof(struct crypt_data));
+#if defined(__GLIBC__) || defined(__EMX__)
+ if (PL_reentrant_buffer->_crypt_struct_buffer) {
+ PL_reentrant_buffer->_crypt_struct_buffer->initialized = 0;
+ /* work around glibc-2.2.5 bug */
+ PL_reentrant_buffer->_crypt_struct_buffer->current_saltbits = 0;
+ }
+ }
+#endif
+# endif /* HAS_CRYPT_R */
+# endif /* USE_ITHREADS */
# ifdef FCRYPT
sv_setpv(TARG, fcrypt(tmps, SvPV(right, n_a)));
# else