summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2015-09-23 15:04:18 +0200
committerJohn Crispin <blogic@openwrt.org>2015-10-03 09:47:35 +0200
commitc2f1f1908b43f945efc99cb43b49e512ee5d02aa (patch)
tree968af72a42f202942e23ad8c0dc8d26c036e18fa
parenta4505284b4d257b490cccd77a50c9c052854e7d5 (diff)
downloadunitd-c2f1f1908b43f945efc99cb43b49e512ee5d02aa.tar
unitd-c2f1f1908b43f945efc99cb43b49e512ee5d02aa.zip
system: fix undefined behavior in wdt offline check
watchdog_fd() is returning a char* and not a int. checking against < 0 could lead in undefined behaviour. Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
-rw-r--r--system.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/system.c b/system.c
index 82c672e..fb7fbe4 100644
--- a/system.c
+++ b/system.c
@@ -282,7 +282,7 @@ static int watchdog_set(struct ubus_context *ctx, struct ubus_object *obj,
if (tb[WDT_STOP])
watchdog_set_stopped(blobmsg_get_bool(tb[WDT_STOP]));
- if (watchdog_fd() < 0)
+ if (watchdog_fd() == NULL)
status = "offline";
else if (watchdog_get_stopped())
status = "stopped";