From b1ef3670f6ab51a6f4c85e517355e5106a07b39d Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Wed, 12 Mar 2003 01:26:25 +0000 Subject: [PATCH] Move declaration of struct tm dummy outside of a control block so it is accessible later on during snprintf in get_http_time. --- cgi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cgi.c b/cgi.c index 803d98a9..332b0b27 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.70.2.4 2003/03/07 03:41:03 david__schmidt Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.70.2.5 2003/03/11 11:53:58 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/Attic/cgi.c,v $ @@ -38,6 +38,9 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.70.2.4 2003/03/07 03:41:03 david__schmidt * * Revisions : * $Log: cgi.c,v $ + * Revision 1.70.2.5 2003/03/11 11:53:58 oes + * Cosmetic: Renamed cryptic variable + * * Revision 1.70.2.4 2003/03/07 03:41:03 david__schmidt * Wrapping all *_r functions (the non-_r versions of them) with mutex semaphores for OSX. Hopefully this will take care of all of those pesky crash reports. * @@ -1515,6 +1518,15 @@ void get_http_time(int time_offset, char *buf) struct tm *t; time_t current_time; +#ifdef HAVE_GMTIME_R + /* + * Declare dummy up here (instead of inside get/set gmt block) so it + * doesn't go out of scope before it's potentially used in snprintf later. + * Wrapping declaration inside HAVE_GMTIME_R keeps the compiler quiet when + * !defined HAVE_GMTIME_R. + */ + struct tm dummy; +#endif assert(buf); @@ -1529,7 +1541,6 @@ void get_http_time(int time_offset, char *buf) t = gmtime(¤t_time); pthread_mutex_unlock(&gmtime_mutex); #elif HAVE_GMTIME_R - struct tm dummy; t = gmtime_r(¤t_time, &dummy); #else t = gmtime(¤t_time); -- 2.49.0