diff options
author | John Crispin <blogic@openwrt.org> | 2014-12-14 22:12:45 +0100 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-12-14 22:28:55 +0100 |
commit | 61cfe0d093056b85a311f06d44ac149e5dbb4d1a (patch) | |
tree | 74e598edf06f0e3dfc6380775ee5ea1e6ecd7105 | |
parent | 40c4e68266a7b04239394c528c4c290d960fc38c (diff) | |
download | unitd-61cfe0d093056b85a311f06d44ac149e5dbb4d1a.tar unitd-61cfe0d093056b85a311f06d44ac149e5dbb4d1a.zip |
only write to the watchdog if the fd is valid
Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r-- | watchdog.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -35,7 +35,7 @@ static int wdt_frequency = 5; void watchdog_ping(void) { DEBUG(4, "Ping\n"); - if (write(wdt_fd, "X", 1) < 0) + if (wdt_fd >= 0 && write(wdt_fd, "X", 1) < 0) ERROR("WDT failed to write: %s\n", strerror(errno)); } |