fix for bug 172396: localtime_r needs to call tzset. Fix patch to allow

non-multithreaded perl builds to work.
This commit is contained in:
jvdias 2006-03-27 21:16:56 +00:00
parent f1e4d163dc
commit 075d1f51d8

View File

@ -1,21 +1,6 @@
--- perl-5.8.7/reentr.inc.161305 2005-11-03 12:56:58.000000000 -0500
+++ perl-5.8.7/reentr.inc 2005-11-03 12:58:16.000000000 -0500
@@ -1368,10 +1368,10 @@
#ifdef HAS_LOCALTIME_R
# undef localtime
# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS
-# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0)
+# define localtime(a) ( L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0)
# endif
# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_I_TS
-# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0)
+# define localtime(a) ( L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0)
# endif
#endif /* HAS_LOCALTIME_R */
--- perl-5.8.7/config_h.SH.161305 2005-04-30 10:34:20.000000000 -0400
+++ perl-5.8.7/config_h.SH 2005-11-03 12:58:16.000000000 -0500
@@ -1916,7 +1916,18 @@
--- perl-5.8.8/config_h.SH.bz172396 2005-10-31 13:13:05.000000000 -0500
+++ perl-5.8.8/config_h.SH 2006-03-27 16:09:01.000000000 -0500
@@ -1912,7 +1912,18 @@
*/
#$d_localtime_r HAS_LOCALTIME_R /**/
#define LOCALTIME_R_PROTO $localtime_r_proto /**/
@ -35,9 +20,24 @@
/* HAS_LONG_DOUBLE:
* This symbol will be defined if the C compiler supports long
* doubles.
--- perl-5.8.7/Configure.161305 2005-11-03 12:56:58.000000000 -0500
+++ perl-5.8.7/Configure 2005-11-03 13:13:54.000000000 -0500
@@ -528,6 +528,7 @@
--- perl-5.8.8/reentr.inc.bz172396 2006-03-27 16:09:01.000000000 -0500
+++ perl-5.8.8/reentr.inc 2006-03-27 16:09:01.000000000 -0500
@@ -1368,10 +1368,10 @@
#ifdef HAS_LOCALTIME_R
# undef localtime
# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS
-# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0)
+# define localtime(a) ( L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0)
# endif
# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_I_TS
-# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0)
+# define localtime(a) ( L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0)
# endif
#endif /* HAS_LOCALTIME_R */
--- perl-5.8.8/Configure.bz172396 2006-03-27 16:09:01.000000000 -0500
+++ perl-5.8.8/Configure 2006-03-27 16:09:33.000000000 -0500
@@ -542,6 +542,7 @@
d_libm_lib_version=''
d_link=''
d_localtime_r=''
@ -45,7 +45,7 @@
localtime_r_proto=''
d_locconv=''
d_lockf=''
@@ -14023,7 +14024,55 @@
@@ -14261,7 +14262,58 @@
*) localtime_r_proto=0
;;
esac
@ -72,13 +72,13 @@
+
+ strcpy(tz_e,e_tz);
+ strcpy(tz_w,w_tz);
+
+ putenv(tz_e);
+ localtime_r(&t, &tm_e);
+
+ putenv(tz_w);
+ localtime_r(&t, &tm_w);
+
+ if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
+ return 1;
+ return 0;
@ -97,11 +97,14 @@
+ fi;
+ rm -f try.c;
+ ;;
+ *)
+ d_localtime_r_needs_tzset=undef;
+ ;;
+esac
: see if localeconv exists
set localeconv d_locconv
eval $inlibc
@@ -20769,6 +20818,7 @@
@@ -21220,6 +21272,7 @@
d_libm_lib_version='$d_libm_lib_version'
d_link='$d_link'
d_localtime_r='$d_localtime_r'