develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH] *time_r fixes

Thread Next
From:
Arthur Bergman
Date:
August 16, 2001 05:17
Subject:
[PATCH] *time_r fixes
Message ID:
00b901c1264e$1cbe6970$21000a0a@vogw2kdev
Do not trust return value of localtime_ r and gmtime_r. Fixes HP-UX 10.20.

--- perl-current-clone/op.h Thu Aug 16 13:54:48 2001
+++ perl-current/op.h Thu Aug 16 13:58:36 2001
@@ -464,7 +464,7 @@
 typedef struct {
   struct tm* tmbuff;
 } REBUF;
-#define localtime(a)       localtime_r(a,PL_reentrant_buffer->tmbuff)
-#define gmtime(a)          gmtime_r(a,PL_reentrant_buffer->tmbuff)
+#define localtime(a)       (localtime_r(a,PL_reentrant_buffer->tmbuff) && PL_reentrant_buffer->tmbuff)
+#define gmtime(a)          (gmtime_r(a,PL_reentrant_buffer->tmbuff) && PL_reentrant_buffer->tmbuff)
 #endif
 



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About