summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-03 12:27:12 +0100
committerSven Eden <yamakuzure@gmx.net>2017-04-26 12:58:55 +0200
commit9e42188e79377946c9d5c197abfb58ad88d7baae (patch)
tree02fd8e21cc1350869b8dbd1e81ac7ee24a96d1b1
parent5e42721bc2e1734adbd966b0e0d89ce80834ca97 (diff)
sd-daemon: explicitly filter out -1 when parsing watchdog timeout
We already filter out 0, and as -1 is usually special (meaning infinity, as in USEC_INFINITY) we should better not accept it either. Better safe than sorry...
-rw-r--r--src/libelogind/sd-daemon/sd-daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libelogind/sd-daemon/sd-daemon.c b/src/libelogind/sd-daemon/sd-daemon.c
index 3ea9764c4..e47da68a6 100644
--- a/src/libelogind/sd-daemon/sd-daemon.c
+++ b/src/libelogind/sd-daemon/sd-daemon.c
@@ -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;
- if (u <= 0) {
+ if (u <= 0 || u >= USEC_INFINITY) {
r = -EINVAL;
goto finish;
}