diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2015-09-23 15:04:18 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2015-10-03 09:47:35 +0200 |
commit | c2f1f1908b43f945efc99cb43b49e512ee5d02aa (patch) | |
tree | 968af72a42f202942e23ad8c0dc8d26c036e18fa | |
parent | a4505284b4d257b490cccd77a50c9c052854e7d5 (diff) | |
download | unitd-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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"; |