diff options
Diffstat (limited to 'src/dmon.c')
-rw-r--r-- | src/dmon.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,7 +34,7 @@ * */ -#include <sys/types.h> +#include <sys/wait.h> #include <sys/stat.h> #include <unistd.h> #include <paths.h> @@ -54,7 +54,7 @@ #define DMON_ABRT(...) do { \ DMON_LOG (__VA_ARGS__); \ - if (kill (getpid (), SIGINT) < 0) \ + if (kill (getpid (), SIGINT) == -1) \ { \ DMON_LOG (_("Could not stop daemon properly: %s\n"), \ strerror (errno)); \ @@ -143,8 +143,7 @@ static unsigned daemonize(int status) || !sigs_set_hdlr(SIGTERM, dmon_sigs_hdlr) || !sigs_set_hdlr(SIGALRM, dmon_sigs_hdlr) || !sigs_set_hdlr(SIGQUIT, dmon_sigs_hdlr) - || !sigs_set_hdlr(SIGUSR1, dmon_sigs_hdlr) - || !sigs_set_hdlr(SIGCHLD, SIG_IGN)) + || !sigs_set_hdlr(SIGUSR1, dmon_sigs_hdlr)) return 0; return 1; @@ -203,6 +202,9 @@ void dmon_start(int parent_exit_status) DMON_SLEEP_TIME); psleep(DMON_SLEEP_TIME); DMON_LOG(_("awakened at %s\n"), nowstr()); + /* Reap the user-defined notifications. */ + while (waitpid(0, NULL, WNOHANG) > 0) + ; } } |