1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

util: fix sign-compare warning

This commit is contained in:
Yu Watanabe 2019-06-21 12:56:54 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent abb9cc50af
commit 8164e30603

View File

@ -267,13 +267,12 @@ static char *format_timestamp_internal(
assert(buf);
if (l <
3 + /* week day */
1 + 10 + /* space and date */
1 + 8 + /* space and time */
(us ? 1 + 6 : 0) + /* "." and microsecond part */
1 + 1 + /* space and shortest possible zone */
1)
if (l < (size_t) (3 + /* week day */
1 + 10 + /* space and date */
1 + 8 + /* space and time */
(us ? 1 + 6 : 0) + /* "." and microsecond part */
1 + 1 + /* space and shortest possible zone */
1))
return NULL; /* Not enough space even for the shortest form. */
if (t <= 0 || t == USEC_INFINITY)
return NULL; /* Timestamp is unset */