From: Amos Jeffries Date: Sat, 21 Jun 2014 04:19:58 +0000 (-0600) Subject: Portability: use 64-bit for X-Cache-Age header X-Git-Tag: SQUID_3_4_6~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=503a306982ec3c6ef926cd41a91e382dc9950cf4;p=thirdparty%2Fsquid.git Portability: use 64-bit for X-Cache-Age header While the value is expected to be well within 32-bit range some OS (OpenBSD 5.5 at least) use 64-bit time_t. Use the larger type size for calculations which also removes 32-bit wrap errors, and cast for older systems. --- diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index bcd7d91189..a297fbd9cc 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1323,7 +1323,7 @@ clientReplyContext::buildReplyHeader() if (http->storeEntry()->timestamp <= squid_curtime) { // put X-Cache-Age: instead of Age: char age[64]; - snprintf(age, sizeof(age), "%ld", (long int) squid_curtime - http->storeEntry()->timestamp); + snprintf(age, sizeof(age), "%" PRId64, static_cast(squid_curtime - http->storeEntry()->timestamp)); hdr->putExt("X-Cache-Age", age); } } else if (http->storeEntry()->timestamp <= squid_curtime) {