From ea3894c1ba26bdfe3f0299dfbe2b767ba92f91dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 21 Feb 2016 23:25:38 +0100 Subject: util-lib: add (void) cast to indicate that we don't care about the normalization success After all, we verify that every calendar part is not out of bounds later on, and it's fully OK if the normalization has no effect. --- src/basic/calendarspec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 775879076d..07315d73e8 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -978,7 +978,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) { for (;;) { /* Normalize the current date */ - mktime_or_timegm(&c, spec->utc); + (void) mktime_or_timegm(&c, spec->utc); c.tm_isdst = -1; c.tm_year += 1900; -- cgit v1.2.3-54-g00ecf From e308ddcae22537b78a9eab22beaa5cb73d86617b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 21 Feb 2016 23:27:20 +0100 Subject: util-lib: fix returned error code Make sure we propagate errors properly. --- src/basic/calendarspec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 07315d73e8..00fc39a499 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -990,8 +990,10 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) { c.tm_mday = 1; c.tm_hour = c.tm_min = c.tm_sec = tm_usec = 0; } - if (r < 0 || tm_out_of_bounds(&c, spec->utc)) + if (r < 0) return r; + if (tm_out_of_bounds(&c, spec->utc)) + return -ENOENT; c.tm_mon += 1; r = find_matching_component(spec->month, &c.tm_mon); -- cgit v1.2.3-54-g00ecf