mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 23:01:24 +02:00
MINOR: tools: make sure to correctly check the returned 'ms' in date2std_log
In commit 4eee38a ("BUILD/MINOR: tools: fix build warning in the date conversion functions") we added some return checks to shut build warnings but the last test is useless since the tested pointer is not updated by the last call to utoa_pad() used to convert the milliseconds. It turns out the original code from 2012 already skipped this part, probably in order to avoid the risk of seeing a millisecond field not belonging to the 0-999 range. Better keep the check and put the code into stricter shape. No backport is needed. This fixes issue #526.
This commit is contained in:
parent
77e463f729
commit
7d9421deca
@ -2952,10 +2952,9 @@ char *date2str_log(char *dst, const struct tm *tm, const struct timeval *date, s
|
|||||||
return NULL;
|
return NULL;
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
|
|
||||||
utoa_pad((unsigned int)(date->tv_usec/1000), dst, 4); // millisecondes
|
dst = utoa_pad((unsigned int)(date->tv_usec/1000)%1000, dst, 4); // milliseconds
|
||||||
if (!dst)
|
if (!dst)
|
||||||
return NULL;
|
return NULL;
|
||||||
dst += 3; // only the 3 first digits
|
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user