projects
/
project
/
procd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
execute the "running" hook once the daemon is started
[project/procd.git]
/
watchdog.c
diff --git
a/watchdog.c
b/watchdog.c
index
e4b82f5
..
d927c53
100644
(file)
--- a/
watchdog.c
+++ b/
watchdog.c
@@
-91,10
+91,12
@@
char* watchdog_fd(void)
return fd_buf;
}
return fd_buf;
}
-void watchdog_init(
void
)
+void watchdog_init(
int preinit
)
{
char *env = getenv("WDTFD");
{
char *env = getenv("WDTFD");
+ if (wdt_fd >= 0)
+ return;
wdt_timeout.cb = watchdog_timeout_cb;
if (env) {
wdt_timeout.cb = watchdog_timeout_cb;
if (env) {
@@
-104,9
+106,13
@@
void watchdog_init(void)
} else {
wdt_fd = open("/dev/watchdog", O_WRONLY);
}
} else {
wdt_fd = open("/dev/watchdog", O_WRONLY);
}
+
if (wdt_fd < 0)
return;
if (wdt_fd < 0)
return;
- fcntl(wdt_fd, F_SETFD, fcntl(wdt_fd, F_GETFD) | FD_CLOEXEC);
+
+ if (!preinit)
+ fcntl(wdt_fd, F_SETFD, fcntl(wdt_fd, F_GETFD) | FD_CLOEXEC);
+
LOG("- watchdog -\n");
watchdog_timeout(30);
watchdog_timeout_cb(&wdt_timeout);
LOG("- watchdog -\n");
watchdog_timeout(30);
watchdog_timeout_cb(&wdt_timeout);