watchdog: Kick one last time before handover to external watchdogd

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-11-18 14:48:46 +01:00
1 parent 2d2807bc65
commit 7f499ed1d0
1 file changed
+7 -5
+7 -5
View File
@@ -51,20 +51,20 @@ static int notify(void)
return -1;
if (connect(sd, (struct sockaddr*)&sun, sizeof(sun)) == -1)
goto exit;
goto bye;
rq.cmd = INIT_CMD_WDOG_HELLO;
rq.magic = INIT_MAGIC;
rq.runlevel = getpid();
len = sizeof(rq);
if (write(sd, &rq, len) != len)
goto exit;
goto bye;
if (read(sd, &rq, len) != len)
goto exit;
goto bye;
result = 0;
exit:
bye:
close(sd);
return result;
}
@@ -105,8 +105,10 @@ static int loop(int fd)
done = 1;
}
if (handover)
if (handover) {
ioctl(fd, WDIOC_KEEPALIVE, &done);
return !write(fd, "V", 1);
}
return 0;
}