X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=watchdog.c;h=592ae7e74f771472ef7a670f8badbac1084d4ed5;hp=3c097e2273c55c34f90c251588aa0630a64f7299;hb=7df968175ffd3bc7df5682d5852fbf20fe454759;hpb=9286d16672b26c9fe7cb9dbf827a43a910df5559 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)); }