rust/chg/src/sighandlers.c
changeset 40119 e70b616a077b
parent 40118 cd490ac908c0
child 41336 763b45bc4483
--- a/rust/chg/src/sighandlers.c	Mon Sep 24 22:04:57 2018 +0900
+++ b/rust/chg/src/sighandlers.c	Mon Sep 24 22:19:49 2018 +0900
@@ -11,16 +11,8 @@
 #include <errno.h>
 #include <signal.h>
 #include <string.h>
-#include <sys/wait.h>
 #include <unistd.h>
 
-#ifdef __GNUC__
-#define UNUSED_ __attribute__((unused))
-#else
-#define UNUSED_
-#endif
-
-static pid_t pagerpid = 0;
 static pid_t peerpgid = 0;
 static pid_t peerpid = 0;
 
@@ -65,17 +57,6 @@
 		return;
 }
 
-static void handlechildsignal(int sig UNUSED_)
-{
-	if (peerpid == 0 || pagerpid == 0)
-		return;
-	/* if pager exits, notify the server with SIGPIPE immediately.
-	 * otherwise the server won't get SIGPIPE if it does not write
-	 * anything. (issue5278) */
-	if (waitpid(pagerpid, NULL, WNOHANG) == pagerpid)
-		kill(peerpid, SIGPIPE);
-}
-
 /*
  * Installs signal handlers.
  *
@@ -131,11 +112,6 @@
 	sa.sa_flags = SA_RESTART;
 	if (sigaction(SIGTSTP, &sa, NULL) < 0)
 		return -1;
-	/* get notified when pager exits */
-	sa.sa_handler = handlechildsignal;
-	sa.sa_flags = SA_RESTART;
-	if (sigaction(SIGCHLD, &sa, NULL) < 0)
-		return -1;
 
 	return 0;
 }
@@ -164,8 +140,6 @@
 		return -1;
 	if (sigaction(SIGTSTP, &sa, NULL) < 0)
 		return -1;
-	if (sigaction(SIGCHLD, &sa, NULL) < 0)
-		return -1;
 
 	/* ignore Ctrl+C while shutting down to make pager exits cleanly */
 	sa.sa_handler = SIG_IGN;