mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 23:20:32 +00:00
test-path: use usec_add() for timeout calculation
Coverity flags now() + 30 * USEC_PER_SEC as overflowing because
now() can return USEC_INFINITY. Use usec_add() which saturates
on overflow instead of wrapping.
CID#1548025
Follow-up for 331461a5a2
This commit is contained in:
@@ -78,9 +78,7 @@ static int _check_states(unsigned line,
|
||||
assert_se(m);
|
||||
assert_se(service);
|
||||
|
||||
/* Silence static analyzers */
|
||||
assert_cc(30 * USEC_PER_SEC <= USEC_INFINITY);
|
||||
usec_t end = now(CLOCK_MONOTONIC) + 30 * USEC_PER_SEC;
|
||||
usec_t end = usec_add(now(CLOCK_MONOTONIC), 30 * USEC_PER_SEC);
|
||||
|
||||
while (path->state != path_state || service->state != service_state ||
|
||||
path->result != PATH_SUCCESS || service->result != SERVICE_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user