summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-08 23:56:30 +0100
committerLennart Poettering <lennart@poettering.net>2016-02-10 16:09:24 +0100
commit89beff89edba592366b2960bd830d3f6e602c2c7 (patch)
tree43daf5fca8f5860bf07b1d1004e8503031db649d /src/core/load-fragment.c
parentaad41f08144ab2333a3c42225c853d7d44f31c56 (diff)
core: treat JobTimeout=0 as equivalent to JobTimeout=infinity
Corrects an incompatibility introduced with 36c16a7cdd6c33d7980efc2cd6a2211941f302b4. Fixes: #2537
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index cd80e95598..e0c318c110 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1757,6 +1757,42 @@ int config_parse_service_timeout(
return 0;
}
+int config_parse_sec_fix_0(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ usec_t *usec = data;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(usec);
+
+ /* This is pretty much like config_parse_sec(), except that this treats a time of 0 as infinity, for
+ * compatibility with older versions of systemd where 0 instead of infinity was used as indicator to turn off a
+ * timeout. */
+
+ r = parse_sec(rvalue, usec);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse %s= parameter, ignoring: %s", lvalue, rvalue);
+ return 0;
+ }
+
+ if (*usec <= 0)
+ *usec = USEC_INFINITY;
+
+ return 0;
+}
+
int config_parse_busname_service(
const char *unit,
const char *filename,