diff -urN autofs-0.3.13/.version autofs-0.3.14-pre2/.version --- autofs-0.3.13/.version Wed Sep 17 18:21:36 1997 +++ autofs-0.3.14-pre2/.version Fri Sep 19 15:21:06 1997 @@ -1 +1 @@ -0.3.13 +0.3.14 diff -urN autofs-0.3.13/NEWS autofs-0.3.14-pre2/NEWS --- autofs-0.3.13/NEWS Wed Sep 17 18:21:36 1997 +++ autofs-0.3.14-pre2/NEWS Fri Sep 19 15:21:06 1997 @@ -1,9 +1,14 @@ +Since autofs-0.3.13: +-------------------- +* Simplified the signalling/forking structure. +* When debugging, leave debug-related signals in the default state. + Since autofs-0.3.12: -------------------- * Added -p, --pid-file option to daemon. * Fixed aestetic bug in new spawn() logic. * Added new cleanup_exit() function in the daemon. -* Added signal handling to some cases that was improperly ignored. +* Added signal handling to some cases that were improperly dealt with. * Integrated new sample stuff from Miquel van Smoorenburg and Christoph Lameter. diff -urN autofs-0.3.13/daemon/automount.c autofs-0.3.14-pre2/daemon/automount.c --- autofs-0.3.13/daemon/automount.c Wed Sep 17 18:21:36 1997 +++ autofs-0.3.14-pre2/daemon/automount.c Fri Sep 19 15:21:06 1997 @@ -336,7 +336,7 @@ struct stat st; sigset_t allsignals, oldsig, chldsig; pid_t f; - + if (get_pkt(ap.pipefd, &pkt)) return -1; @@ -378,29 +378,16 @@ close(ap.pipefd); close(ap.ioctlfd); - /* Wait for go-ahead from main process. Fortunately signals sent - by a process to itself are synchronous events per POSIX.1 */ - kill(getpid(), SIGSTOP); i = ap.lookup->lookup_mount(ap.path,pkt.name,pkt.len,ap.lookup->context); _exit(i ? 1 : 0); } else { - int status; - - /* Leave SIGCHLD blocked so the waitpid() below works correctly */ - sigaddset(&oldsig, SIGCHLD); - sigprocmask(SIG_SETMASK, &oldsig, NULL); + /* Important: set up data structures while signals still blocked */ mt->pid = f; mt->wait_queue_token = pkt.wait_queue_token; mt->next = ap.mounts; ap.mounts = mt; - if ( waitpid(f, &status, WUNTRACED) != f || - !WIFSTOPPED(status) ) { - sigprocmask(SIG_UNBLOCK, &chldsig, NULL); - send_fail(pkt.wait_queue_token); - return 1; - } - sigprocmask(SIG_UNBLOCK, &chldsig, NULL); - kill(f, SIGCONT); /* Go for it */ + + sigprocmask(SIG_SETMASK, &oldsig, NULL); } } else { /* Already there (can happen if a process connects to a @@ -629,15 +616,10 @@ sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; + sigaction(SIGVTALRM, &sa, NULL); #ifdef SIGUNUSED sigaction(SIGUNUSED, &sa, NULL); #endif -#ifdef SIGLOST - sigaction(SIGLOST, &sa, NULL); -#endif - sigaction(SIGVTALRM, &sa, NULL); - sigaction(SIGPROF, &sa, NULL); - sigaction(SIGPIPE, &sa, NULL); sa.sa_handler = sig_shutdown; sigemptyset(&sa.sa_mask); @@ -646,25 +628,36 @@ sigaction(SIGINT, &sa, NULL); sigaction(SIGQUIT, &sa, NULL); sigaction(SIGILL, &sa, NULL); - sigaction(SIGTRAP, &sa, NULL); - sigaction(SIGABRT, &sa, NULL); - sigaction(SIGIOT, &sa, NULL); - sigaction(SIGBUS, &sa, NULL); - sigaction(SIGFPE, &sa, NULL); - sigaction(SIGSEGV, &sa, NULL); sigaction(SIGTERM, &sa, NULL); sigaction(SIGIO, &sa, NULL); sigaction(SIGXCPU, &sa, NULL); sigaction(SIGXFSZ, &sa, NULL); -#ifdef SIGSYS - sigaction(SIGSYS, &sa, NULL); -#endif #ifdef SIGPWR sigaction(SIGPWR, &sa, NULL); #endif + +#ifndef DEBUG + /* When debugging, these signals should be in the default state; when + in production, we want to at least attempt to catch them and shut down. */ + sigaction(SIGABRT, &sa, NULL); + sigaction(SIGTRAP, &sa, NULL); + sigaction(SIGFPE, &sa, NULL); + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); + sigaction(SIGPROF, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL); +#ifdef SIGSYS + sigaction(SIGSYS, &sa, NULL); +#endif #ifdef SIGSTKFLT sigaction(SIGSTKFLT, &sa, NULL); #endif +#ifdef SIGLOST + sigaction(SIGLOST, &sa, NULL); +#endif +#endif /* DEBUG */ + + /* USR2 is special, but is handled by the same handler */ sigaction(SIGUSR2, &sa, NULL); sa.sa_handler = sig_child;