+ int status;
+
+ wait(&status);
+#endif
+ lastsig = SIGCHLD;
+ (void)sig;
+}
+
+RETSIGTYPE null_signal_handler(int sig) { (void)sig; }
+
+SIGHANDLERTYPE set_signal_handler(int sig, SIGHANDLERTYPE handler)
+/*
+ * This function is called by other parts of the program to
+ * setup the signal handler after a change to the signal context.
+ * This is done to improve robustness of the signal handling code.
+ * It has the same prototype as signal(2).
+ */
+{
+ SIGHANDLERTYPE rethandler;
+#ifdef HAVE_SIGACTION
+ struct sigaction sa_new, sa_old;
+
+ memset (&sa_new, 0, sizeof sa_new);
+ sigemptyset (&sa_new.sa_mask);
+ sa_new.sa_handler = handler;
+ sa_new.sa_flags = 0;
+#ifdef SA_RESTART /* SunOS 4.1 portability hack */
+ /* system call should restart on all signals except SIGALRM */
+ if (sig != SIGALRM)
+ sa_new.sa_flags |= SA_RESTART;