From 771c2be67b01f26776335f945a44a05d3a510d17 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 19 May 2006 17:06:11 +0000 Subject: - Don't hang on exit on FreeBSD --- daemon/httpauthd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'daemon/httpauthd.c') diff --git a/daemon/httpauthd.c b/daemon/httpauthd.c index bff12cb..474af5f 100644 --- a/daemon/httpauthd.c +++ b/daemon/httpauthd.c @@ -432,7 +432,11 @@ int main(int argc, char* argv[]) if(threads[i].tid != 0) { if(threads[i].fd != -1) + { shutdown(threads[i].fd, SHUT_RDWR); + close(threads[i].fd); + threads[i].fd = -1; + } pthread_join(threads[i].tid, NULL); } @@ -503,10 +507,14 @@ static void writepid(const char* pidfile) static void* httpauth_thread(void* arg) { httpauth_thread_t* thread = (httpauth_thread_t*)arg; + sigset_t set; int r; - siginterrupt(SIGINT, 1); - siginterrupt(SIGTERM, 1); + /* We handle these signals on the main thread */ + sigemptyset(&set); + sigaddset(&set, SIGINT); + sigaddset(&set, SIGTERM); + pthread_sigmask(SIG_BLOCK, &set, NULL); ASSERT(thread); ASSERT(thread->fd != -1); -- cgit v1.2.3