X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=parsers.c;h=1e71b61d90e5e5cd580e951e6eb1749269875f1e;hb=a0d99cad0114068fd253888a7fa313de282d140a;hp=40c58f37299920a9f7691245d6840f858a640a28;hpb=fe33cd8ff935666ea91799111a46b62411da3142;p=privoxy.git diff --git a/parsers.c b/parsers.c index 40c58f37..1e71b61d 100644 --- a/parsers.c +++ b/parsers.c @@ -2748,9 +2748,8 @@ static jb_err server_last_modified(struct client_state *csp, char **header) time_t now; struct tm *timeptr = NULL; long int rtime; -#ifdef HAVE_GMTIME_R struct tm gmt; -#endif + now = time(NULL); rtime = (long int)difftime(now, last_modified); if (rtime) @@ -2769,29 +2768,16 @@ static jb_err server_last_modified(struct client_state *csp, char **header) rtime *= -1; } last_modified += rtime; -#ifdef HAVE_GMTIME_R - timeptr = gmtime_r(&last_modified, &gmt); -#elif defined(MUTEX_LOCKS_AVAILABLE) - privoxy_mutex_lock(&gmtime_mutex); - timeptr = gmtime(&last_modified); -#else - timeptr = gmtime(&last_modified); -#endif + timeptr = privoxy_gmtime_r(&last_modified, &gmt); if ((NULL == timeptr) || !strftime(newheader, sizeof(newheader), "%a, %d %b %Y %H:%M:%S GMT", timeptr)) { -#if !defined(HAVE_GMTIME_R) && defined(MUTEX_LOCKS_AVAILABLE) - privoxy_mutex_unlock(&gmtime_mutex); -#endif log_error(LOG_LEVEL_ERROR, "Randomizing '%s' failed. Crunching the header without replacement.", *header); freez(*header); return JB_ERR_OK; } -#if !defined(HAVE_GMTIME_R) && defined(MUTEX_LOCKS_AVAILABLE) - privoxy_mutex_unlock(&gmtime_mutex); -#endif freez(*header); *header = strdup("Last-Modified: "); string_append(header, newheader);