summaryrefslogtreecommitdiff
path: root/www/liferea/patches/patch-ae
blob: 8564628f26c68c8c3234cda4581fcda0fd269064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$NetBSD: patch-ae,v 1.3 2008/01/16 19:53:24 smb Exp $

--- src/common.c.orig	2007-10-21 14:30:46.000000000 -0400
+++ src/common.c	2008-01-09 15:58:30.000000000 -0500
@@ -37,7 +37,7 @@
 #  include <config.h>
 #endif
 
-#define _XOPEN_SOURCE /* glibc2 needs this (man strptime) */
+#define _XOPEN_SOURCE	600 /* Set according to Opengroup standards */
 
 #include <libxml/uri.h>
 
@@ -196,7 +196,7 @@
 
 /* converts a ISO 8601 time string to a time_t value */
 time_t parseISO8601Date(gchar *date) {
-	struct tm	tm;
+	struct tm	tm, t2buf;
 	time_t		t, t2, offset = 0;
 	gboolean	success = FALSE;
 	gchar *pos;
@@ -252,7 +252,7 @@
 		if((time_t)(-1) != (t = mktime(&tm))) {
 			/* Correct for the local timezone*/
 			t = t - offset;
-			t2 = mktime(gmtime(&t));
+			t2 = mktime(gmtime_r(&t, &t2buf));
 			t = t - (t2 - t);
 			
 			return t;
@@ -270,9 +270,9 @@
 gchar *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
 
 gchar *createRFC822Date(const time_t *time) {
-	struct tm *tm;
+	struct tm *tm, tmbuf;
 
-	tm = gmtime(time); /* No need to free because it is statically allocated */
+	tm = gmtime_r(time, &tmbuf); /* No need to free because it is statically allocated */
 	return g_strdup_printf("%s, %2d %s %4d %02d:%02d:%02d GMT", dayofweek[tm->tm_wday], tm->tm_mday,
 					   months[tm->tm_mon], 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec);
 }
@@ -322,7 +322,7 @@
 
 /* converts a RFC822 time string to a time_t value */
 time_t parseRFC822Date(gchar *date) {
-	struct tm	tm;
+	struct tm	tm, t2buf;
 	time_t		t, t2;
 	char 		*oldlocale;
 	char		*pos;
@@ -370,7 +370,7 @@
 			   correction. (Usually, there is no daylight savings
 			   time since the input is GMT.) */
 			t = t - common_parse_rfc822_tz(pos);
-			t2 = mktime(gmtime(&t));
+			t2 = mktime(gmtime_r(&t, &t2buf));
 			t = t - (t2 - t);
 			return t;
 		} else {