catch signals in the async dns daemon and allow it to auto-restart if
authorAndrew Tridgell <tridge@samba.org>
Thu, 4 Dec 1997 10:58:40 +0000 (10:58 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 4 Dec 1997 10:58:40 +0000 (10:58 +0000)
necessary
(This used to be commit fa599067f074647a5bad2ffd0fce12ae0a4e43d2)

source3/nmbd/asyncdns.c

index f15880080f5e5bec7f78b0828915f5e36e789499..57d0eda9b36601f3050e09f2b3384d048cbd2323 100644 (file)
@@ -128,6 +128,10 @@ void start_async_dns(void)
        fd_in = fd2[0];
        fd_out = fd1[1];
 
        fd_in = fd2[0];
        fd_out = fd1[1];
 
+       signal(SIGUSR2, SIG_IGN);
+       signal(SIGUSR1, SIG_IGN);
+       signal(SIGHUP, SIG_IGN);
+
        asyncdns_process();
 }
 
        asyncdns_process();
 }
 
@@ -167,6 +171,11 @@ void run_dns_queue(void)
        if (fd_in == -1)
                return;
 
        if (fd_in == -1)
                return;
 
+       if (!process_exists(child_pid)) {
+               close(fd_in);
+               start_async_dns();
+       }
+
        if ((size=read_data(fd_in, (char *)&r, sizeof(r))) != sizeof(r)) {
                if (size) {
                        DEBUG(0,("Incomplete DNS answer from child!\n"));
        if ((size=read_data(fd_in, (char *)&r, sizeof(r))) != sizeof(r)) {
                if (size) {
                        DEBUG(0,("Incomplete DNS answer from child!\n"));