diff options
-rw-r--r-- | networking/httpd.c | 6 | ||||
-rw-r--r-- | runit/svlogd.c | 4 | ||||
-rw-r--r-- | sysklogd/syslogd_and_logger.c | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 74196a4f1..9439e206c 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1046,6 +1046,7 @@ static void send_headers(int responseNum) | |||
1046 | /* Fixed size 29-byte string. Example: Sun, 06 Nov 1994 08:49:37 GMT */ | 1046 | /* Fixed size 29-byte string. Example: Sun, 06 Nov 1994 08:49:37 GMT */ |
1047 | char date_str[40]; /* using a bit larger buffer to paranoia reasons */ | 1047 | char date_str[40]; /* using a bit larger buffer to paranoia reasons */ |
1048 | 1048 | ||
1049 | struct tm tm; | ||
1049 | const char *responseString = ""; | 1050 | const char *responseString = ""; |
1050 | const char *infoString = NULL; | 1051 | const char *infoString = NULL; |
1051 | #if ENABLE_FEATURE_HTTPD_ERROR_PAGES | 1052 | #if ENABLE_FEATURE_HTTPD_ERROR_PAGES |
@@ -1074,7 +1075,8 @@ static void send_headers(int responseNum) | |||
1074 | * always fit into those kbytes. | 1075 | * always fit into those kbytes. |
1075 | */ | 1076 | */ |
1076 | 1077 | ||
1077 | strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime(&timer)); | 1078 | strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime_r(&timer, &tm)); |
1079 | /* ^^^ using gmtime_r() instead of gmtime() to not use static data */ | ||
1078 | len = sprintf(iobuf, | 1080 | len = sprintf(iobuf, |
1079 | "HTTP/1.0 %d %s\r\n" | 1081 | "HTTP/1.0 %d %s\r\n" |
1080 | "Content-type: %s\r\n" | 1082 | "Content-type: %s\r\n" |
@@ -1128,7 +1130,7 @@ static void send_headers(int responseNum) | |||
1128 | #endif | 1130 | #endif |
1129 | 1131 | ||
1130 | if (file_size != -1) { /* file */ | 1132 | if (file_size != -1) { /* file */ |
1131 | strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime(&last_mod)); | 1133 | strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime_r(&last_mod, &tm)); |
1132 | #if ENABLE_FEATURE_HTTPD_RANGES | 1134 | #if ENABLE_FEATURE_HTTPD_RANGES |
1133 | if (responseNum == HTTP_PARTIAL_CONTENT) { | 1135 | if (responseNum == HTTP_PARTIAL_CONTENT) { |
1134 | len += sprintf(iobuf + len, | 1136 | len += sprintf(iobuf + len, |
diff --git a/runit/svlogd.c b/runit/svlogd.c index 412290ca9..13de2570f 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c | |||
@@ -347,11 +347,13 @@ static unsigned pmatch(const char *p, const char *s, unsigned len) | |||
347 | /* NUL terminated */ | 347 | /* NUL terminated */ |
348 | static void fmt_time_human_30nul(char *s, char dt_delim) | 348 | static void fmt_time_human_30nul(char *s, char dt_delim) |
349 | { | 349 | { |
350 | struct tm tm; | ||
350 | struct tm *ptm; | 351 | struct tm *ptm; |
351 | struct timeval tv; | 352 | struct timeval tv; |
352 | 353 | ||
353 | gettimeofday(&tv, NULL); | 354 | gettimeofday(&tv, NULL); |
354 | ptm = gmtime(&tv.tv_sec); | 355 | ptm = gmtime_r(&tv.tv_sec, &tm); |
356 | /* ^^^ using gmtime_r() instead of gmtime() to not use static data */ | ||
355 | sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000", | 357 | sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000", |
356 | (unsigned)(1900 + ptm->tm_year), | 358 | (unsigned)(1900 + ptm->tm_year), |
357 | (unsigned)(ptm->tm_mon + 1), | 359 | (unsigned)(ptm->tm_mon + 1), |
diff --git a/sysklogd/syslogd_and_logger.c b/sysklogd/syslogd_and_logger.c index 9bba195d4..94d8273b6 100644 --- a/sysklogd/syslogd_and_logger.c +++ b/sysklogd/syslogd_and_logger.c | |||
@@ -53,6 +53,7 @@ typedef struct _code { | |||
53 | static const CODE *const bb_prioritynames = prioritynames; | 53 | static const CODE *const bb_prioritynames = prioritynames; |
54 | static const CODE *const bb_facilitynames = facilitynames; | 54 | static const CODE *const bb_facilitynames = facilitynames; |
55 | 55 | ||
56 | |||
56 | #if ENABLE_SYSLOGD | 57 | #if ENABLE_SYSLOGD |
57 | #include "syslogd.c" | 58 | #include "syslogd.c" |
58 | #endif | 59 | #endif |