diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/testd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/testd.c b/examples/testd.c index 12b2940..ec5f690 100644 --- a/examples/testd.c +++ b/examples/testd.c @@ -38,7 +38,13 @@ int main(int argc, char *argv[]) { int ret; /* Kill daemon with SIGINT */ + + /* Check if the new function daemon_pid_file_kill_wait() is available, if it is, use it. */ +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + if ((ret = daemon_pid_file_kill_wait(SIGINT, 5)) < 0) +#else if ((ret = daemon_pid_file_kill(SIGINT)) < 0) +#endif daemon_log(LOG_WARNING, "Failed to kill daemon"); return ret < 0 ? 1 : 0; @@ -70,6 +76,7 @@ int main(int argc, char *argv[]) { return 255; } + daemon_log(ret != 0 ? LOG_ERR : LOG_INFO, "Daemon returned %i as return value.", ret); return ret; } else { /* The daemon */ |