diff --git a/procServ.cc b/procServ.cc index 750a6c1..ca6944a 100644 --- a/procServ.cc +++ b/procServ.cc @@ -109,12 +109,10 @@ void writeInfoFile(const std::string& infofile); void ttySetCharNoEcho(bool save); // Signal handlers -static void OnSigPipe(int); static void OnSigTerm(int); static void OnSigHup(int); // Flags used for communication between sig handler and main() -static volatile sig_atomic_t sigPipeSet; static volatile sig_atomic_t sigTermSet; static volatile sig_atomic_t sigHupSet; @@ -476,24 +474,23 @@ int main(int argc,char * argv[]) PRINTF("Installing signal handlers\n"); - // SIGPIPE, SIGTERM and SIGHUP will be handled in the main loop + // SIGTERM and SIGHUP will be handled in the main loop // with the assistance of pselect. This means that we have them // blocked outside of pselect call, but unblocked atomically // within pselect. Each time pselect returns, we safely check if - // any of the signals were received. + // any of the signals were received. SIGPIPE will be ignored. - // Block the signals that we bill be handling in the main loop. + // Block the signals that we will be handling in the main loop. // At the same time, retrieve the original signal mask before // blocking, to be passed to pselect. sigset_t sigset_block; sigset_t sigset_pselect; sigemptyset(&sigset_block); - sigaddset(&sigset_block, SIGPIPE); sigaddset(&sigset_block, SIGTERM); sigaddset(&sigset_block, SIGHUP); sigprocmask(SIG_BLOCK, &sigset_block, &sigset_pselect); - sig.sa_handler = &OnSigPipe; // sigaction() needed for Solaris + sig.sa_handler = SIG_IGN; // sigaction() needed for Solaris sigaction(SIGPIPE, &sig, NULL); sig.sa_handler = &OnSigTerm; sigaction(SIGTERM, &sig, NULL); @@ -598,8 +595,6 @@ int main(int argc,char * argv[]) // Run here until something makes it die while ( ! shutdownServer ) { - const size_t BUFLEN = 100; - char buf[BUFLEN]; connectionItem * p; fd_set fdset; // FD stuff for select() int fd, nFd; @@ -625,12 +620,6 @@ int main(int argc,char * argv[]) // Handle signals for which signal handlers were called while in pselect. - if (sigPipeSet) { - sigPipeSet = 0; - sprintf( buf, "@@@ Got a sigPipe signal: Did the child close its tty?" NL); - SendToAll( buf, strlen(buf), NULL ); - } - if (sigTermSet) { sigTermSet = 0; PRINTF("SigTerm received\n"); @@ -848,11 +837,6 @@ void DeleteConnection(connectionItem *ci) assert(connectionNo>=0); } -static void OnSigPipe(int) -{ - sigPipeSet = 1; -} - static void OnSigTerm(int) { sigTermSet = 1;