From: Amos Jeffries Date: Thu, 7 Apr 2016 04:43:45 +0000 (+1200) Subject: Bug 4480: Regression in logformat [.width_max] X-Git-Tag: SQUID_3_5_17~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5f4e2c31d0179e8f7c9577d84f204e237536595;p=thirdparty%2Fsquid.git Bug 4480: Regression in logformat [.width_max] --- diff --git a/src/format/Format.cc b/src/format/Format.cc index 71e656a69f..d48e6703e7 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -323,6 +323,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS int dofree = 0; int64_t outoff = 0; int dooff = 0; + int doSec = 0; switch (fmt->type) { @@ -508,6 +509,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS int precision = fmt->widthMax >=0 ? fmt->widthMax :3; snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", fmt->zero && (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - precision - 1 : 0, static_cast(al->cache.start_time.tv_sec), precision, (int)(al->cache.start_time.tv_usec / fmt->divisor)); out = tmp; + doSec = 1; } break; @@ -1294,7 +1296,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS } // enforce width limits if configured - const bool haveMaxWidth = fmt->widthMax >=0 && !doint && !dooff && !fmt->divisor; + const bool haveMaxWidth = fmt->widthMax >=0 && !doint && !dooff && !doSec; if (haveMaxWidth || fmt->widthMin) { const int minWidth = fmt->widthMin >= 0 ? fmt->widthMin :0;