From: Lennart Poettering Date: Fri, 6 Jan 2023 10:27:17 +0000 (+0100) Subject: sd-event: don't mistake USEC_INFINITY passed in for overflow X-Git-Tag: v253-rc1~157^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef8591951aefccb668201f24aa481aa6cda834da;p=thirdparty%2Fsystemd.git sd-event: don't mistake USEC_INFINITY passed in for overflow Let's pass USEC_INFINITY from sd_event_source_set_time_relative() to sd_event_source_set_time() instead of raising EOVERFLOW. We should raise EOVERFLOW only if your addition fails, but not if the input already is USEC_INFINITY, since it's an entirely valid operation to have an infinite time-out, and we should support that. --- diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index 6c15bc3ba7d..cefe2a36b4f 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -2726,6 +2726,9 @@ _public_ int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec assert_return(s, -EINVAL); assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM); + if (usec == USEC_INFINITY) + return sd_event_source_set_time(s, USEC_INFINITY); + r = sd_event_now(s->event, event_source_type_to_clock(s->type), &t); if (r < 0) return r;