From: Marcel Hollerbach Date: Wed, 20 Sep 2017 17:26:13 +0000 (+0200) Subject: time-util: mktime_or_timegm are changing the struct tm X-Git-Tag: v235~73^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=214cc95d7bfd6bd22a17c2ac1ab84e31d2e82640;p=platform%2Fupstream%2Fsystemd.git time-util: mktime_or_timegm are changing the struct tm after that wm_day etc. seems to be changed. Moving the check infront of the mktime_or_timegm fixes that. --- diff --git a/src/basic/time-util.c b/src/basic/time-util.c index bcfa427..f67467c 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -849,11 +849,11 @@ parse_usec: } from_tm: - x = mktime_or_timegm(&tm, utc); - if (x < 0) + if (weekday >= 0 && tm.tm_wday != weekday) return -EINVAL; - if (weekday >= 0 && tm.tm_wday != weekday) + x = mktime_or_timegm(&tm, utc); + if (x < 0) return -EINVAL; ret = (usec_t) x * USEC_PER_SEC + x_usec;