From c1de66f911cd527a5dda4f2839f03b28dc23a7a9 Mon Sep 17 00:00:00 2001 From: msweet Date: Fri, 31 Jul 2015 13:29:25 +0000 Subject: [PATCH] Fix the signal handlers in the dnssd and usb backends to only use async-safe functions (STR #4671) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12818 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 3 ++- backend/dnssd.c | 2 +- backend/usb-darwin.c | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index d2be29008..522301d5d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -CHANGES.txt - 2.1rc1 - 2015-07-30 +CHANGES.txt - 2.1rc1 - 2015-07-31 --------------------------------- CHANGES IN CUPS V2.1rc1 @@ -8,6 +8,7 @@ CHANGES IN CUPS V2.1rc1 - Fixed bugs in the new journald support (STR #4655, STR #4658, STR #4661) - Fixed domain socket support on Linux (STR #4679) + - Fixed signal handlers in the dnssd and usb backends (STR #4671) - Configure script changes for systemd support (STR #4669) - Updated autoconf sources to use newer form of AC_INIT (STR #4664) diff --git a/backend/dnssd.c b/backend/dnssd.c index 29e003fb2..9afdecfe8 100644 --- a/backend/dnssd.c +++ b/backend/dnssd.c @@ -1289,7 +1289,7 @@ sigterm_handler(int sig) /* I - Signal number (unused) */ (void)sig; if (job_canceled) - exit(CUPS_BACKEND_OK); + _exit(CUPS_BACKEND_OK); else job_canceled = 1; } diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index ece2a37c9..2bf9615c8 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -2285,13 +2285,13 @@ sigterm_handler(int sig) /* I - Signal */ while (waitpid(child_pid, &status, 0) < 0 && errno == EINTR); if (WIFEXITED(status)) - exit(WEXITSTATUS(status)); + _exit(WEXITSTATUS(status)); else if (status == SIGTERM || status == SIGKILL) - exit(0); + _exit(0); else { - fprintf(stderr, "DEBUG: Child crashed on signal %d\n", status); - exit(CUPS_BACKEND_STOP); + write(2, "DEBUG: Child crashed.\n", 22); + _exit(CUPS_BACKEND_STOP); } } #endif /* __i386__ || __x86_64__ */ -- 2.39.2