mirror of
https://github.com/systemd/systemd
synced 2024-07-21 18:24:38 +00:00
parent
ef8304de53
commit
9102c625a6
|
@ -591,7 +591,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
|
|||
t = b;
|
||||
}
|
||||
|
||||
n = MIN((size_t) k, l);
|
||||
n = MIN((size_t) k, l-1);
|
||||
|
||||
l -= n;
|
||||
p += n;
|
||||
|
|
|
@ -238,6 +238,11 @@ TEST(format_timespan) {
|
|||
test_format_timespan_accuracy(1);
|
||||
test_format_timespan_accuracy(USEC_PER_MSEC);
|
||||
test_format_timespan_accuracy(USEC_PER_SEC);
|
||||
|
||||
/* See issue #23928. */
|
||||
_cleanup_free_ char *buf;
|
||||
assert_se(buf = new(char, 5));
|
||||
assert_se(buf == format_timespan(buf, 5, 100005, 1000));
|
||||
}
|
||||
|
||||
TEST(verify_timezone) {
|
||||
|
|
Loading…
Reference in a new issue