chiark / gitweb /
sd-daemon: explicitly filter out -1 when parsing watchdog timeout
[elogind.git] / src / libelogind / sd-daemon / sd-daemon.c
index 3ea9764c45bd383ec24d9272ed9e3b8b61b5db4f..e47da68a66f3cd6a0bcd82998292e15a14b6b8f2 100644 (file)
@@ -595,7 +595,7 @@ _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) {
         r = safe_atou64(s, &u);
         if (r < 0)
                 goto finish;
         r = safe_atou64(s, &u);
         if (r < 0)
                 goto finish;
-        if (u <= 0) {
+        if (u <= 0 || u >= USEC_INFINITY) {
                 r = -EINVAL;
                 goto finish;
         }
                 r = -EINVAL;
                 goto finish;
         }