X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/12fa790ea0e2b0ef52b0ac0189c6ebd6c8692a1e..ac669e8b922c7ace230294f9bf9a3a2bdfbd19d2:/cleanup.c diff --git a/cleanup.c b/cleanup.c index b1bf256d..b952cff0 100644 --- a/cleanup.c +++ b/cleanup.c @@ -26,6 +26,10 @@ extern int keep_partial; extern int log_got_error; extern char *partial_dir; +#ifdef HAVE_SIGACTION +static struct sigaction sigact; +#endif + /** * Close all open sockets and files, allowing a (somewhat) graceful * shutdown() of socket connections. This eliminates the abortive @@ -94,8 +98,8 @@ void _exit_cleanup(int code, const char *file, int line) } inside_cleanup++; - signal(SIGUSR1, SIG_IGN); - signal(SIGUSR2, SIG_IGN); + SIGACTION(SIGUSR1, SIG_IGN); + SIGACTION(SIGUSR2, SIG_IGN); if (verbose > 3) { rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n", @@ -104,7 +108,8 @@ void _exit_cleanup(int code, const char *file, int line) if (cleanup_child_pid != -1) { int status; - if (waitpid(cleanup_child_pid, &status, WNOHANG) == cleanup_child_pid) { + if (wait_process(cleanup_child_pid, &status, WNOHANG) + == cleanup_child_pid) { status = WEXITSTATUS(status); if (status > code) code = status;