summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--watchdog.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/watchdog.c b/watchdog.c
index 3c097e2..592ae7e 100644
--- a/watchdog.c
+++ b/watchdog.c
@@ -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));
}