mirror of
https://github.com/troglobit/finit.git
synced 2026-10-14 10:19:36 +00:00
watchdog: Kick one last time before handover to external watchdogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
2d2807bc65
commit
7f499ed1d0
1 file changed
+7
-5
+7
-5
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user