2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

784. [bug] nsupdate and other programs would not quit properly

if some signals were blocked by the caller. [RT #1081]
This commit is contained in:
Brian Wellington
2001-03-20 21:45:20 +00:00
parent be09eee21e
commit 48565891e8
2 changed files with 27 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: app.c,v 1.41 2001/03/19 22:44:52 bwelling Exp $ */
/* $Id: app.c,v 1.42 2001/03/20 21:45:20 bwelling Exp $ */
#include <config.h>
@@ -117,10 +117,8 @@ handle_signal(int sig, void (*handler)(int)) {
isc_result_t
isc_app_start(void) {
isc_result_t result;
#ifdef ISC_PLATFORM_USETHREADS
int presult;
sigset_t sset;
#endif /* ISC_PLATFORM_USETHREADS */
/*
* Start an ISC library application.
@@ -218,6 +216,30 @@ isc_app_start(void) {
strerror(presult));
return (ISC_R_UNEXPECTED);
}
#else /* ISC_PLATFORM_USETHREADS */
/*
* Unblock SIGHUP, SIGINT, SIGTERM.
*
* If we're not using threads, we need to make sure that SIGHUP,
* SIGINT and SIGTERM are not inherited as blocked from the parent
* process.
*/
if (sigemptyset(&sset) != 0 ||
sigaddset(&sset, SIGHUP) != 0 ||
sigaddset(&sset, SIGINT) != 0 ||
sigaddset(&sset, SIGTERM) != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_app_start() sigsetops: %s",
strerror(errno));
return (ISC_R_UNEXPECTED);
}
presult = sigprocmask(SIG_UNBLOCK, &sset, NULL);
if (presult != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_app_start() sigprocmask: %s",
strerror(presult));
return (ISC_R_UNEXPECTED);
}
#endif /* ISC_PLATFORM_USETHREADS */
ISC_LIST_INIT(on_run);