[evolution-patches] gmtime race fix (camel)



this is probably only worth committing to HEAD, but whatever...

camel-mime-message.c uses gmtime_r without any #ifdef HAVE_GMTIME_R-type
macros (and configure.in doesn't define one anyway afaict) so I didn't
bother with camel-mime-utils.c either.

however, I'd be ok with writing a configure.in check for this if we feel
we need one (doesn't seem to be an issue for any of our target
platforms?)

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1837
diff -u -r1.1837 ChangeLog
--- ChangeLog	1 Jul 2003 18:10:16 -0000	1.1837
+++ ChangeLog	1 Jul 2003 18:30:42 -0000
@@ -1,3 +1,8 @@
+2003-07-01  Jeffrey Stedfast  <fejj ximian com>
+
+	* camel-mime-utils.c (header_format_date): Use gmtime_r() instead
+	of using gmtime() and memcpy() to try and be "atomic".
+
 2003-06-24  David Woodhouse  <dwmw2 infradead org>
 
 	* camel-mime-utils.c (header_format_date): Put day of week into
Index: camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-utils.c,v
retrieving revision 1.184
diff -u -r1.184 camel-mime-utils.c
--- camel-mime-utils.c	1 Jul 2003 18:10:17 -0000	1.184
+++ camel-mime-utils.c	1 Jul 2003 18:30:44 -0000
@@ -3438,9 +3438,9 @@
 	time += ((offset / 100) * (60*60)) + (offset % 100)*60;
 
 	d(printf("converting date %s", ctime(&time)));
-
-	memcpy(&tm, gmtime(&time), sizeof(tm));
-
+	
+	gmtime_r (&time, &tm);
+	
 	return g_strdup_printf("%s, %02d %s %04d %02d:%02d:%02d %+05d",
 			       tz_days[tm.tm_wday],
 			       tm.tm_mday, tz_months[tm.tm_mon],


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]