]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4480: Regression in logformat [.width_max]
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 7 Apr 2016 04:43:45 +0000 (16:43 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 7 Apr 2016 04:43:45 +0000 (16:43 +1200)
src/format/Format.cc

index 71e656a69f9325a9d63b5e53960ffe426865b826..d48e6703e7e71c051939658c75596fe7fad6c93a 100644 (file)
@@ -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<int64_t>(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;