From: Amos Jeffries Date: Sat, 14 Jun 2014 01:45:50 +0000 (-0700) Subject: POrtability: use 64-bit for X-Cache-Age header X-Git-Tag: SQUID_3_5_0_1~181 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe3f0034f4fa253db4ddea36927f73f2594f71b3;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 c3ba1d153b..7999d8a7f8 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1347,7 +1347,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) {