load-fragment: use parse_sec_fix_0() instead of updating the value later

This commit is contained in:
Yu Watanabe
2018-05-31 11:09:41 +09:00
parent 6c58305ac3
commit fb27be3f60
+4 -8
View File
@@ -1946,19 +1946,15 @@ int config_parse_service_timeout(
/* This is called for two cases: TimeoutSec= and TimeoutStartSec=. */
r = parse_sec(rvalue, &usec);
/* Traditionally, these options accepted 0 to disable the timeouts. However, a timeout of 0 suggests it happens
* immediately, hence fix this to become USEC_INFINITY instead. This is in-line with how we internally handle
* all other timeouts. */
r = parse_sec_fix_0(rvalue, &usec);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse %s= parameter, ignoring: %s", lvalue, rvalue);
return 0;
}
/* Traditionally, these options accepted 0 to disable the timeouts. However, a timeout of 0 suggests it happens
* immediately, hence fix this to become USEC_INFINITY instead. This is in-line with how we internally handle
* all other timeouts. */
if (usec <= 0)
usec = USEC_INFINITY;
s->start_timeout_defined = true;
s->timeout_start_usec = usec;