Subject: PATCH: make FvwmCommand handle SIGPIPE cleanly

From: Scott Smedley <[email-masked]>
Date: Fri, 28 May 2004 15:19:09 +1000

Hi all,

FvwmCommand currently misbehaves if it receives a sigPIPE. Of
particular annoyance, it leaves a FIFO hanging around which means that
subsequent invocations of FvwmCommand fail.

This patch makes FvwmCommand behave much more nicely.

SCoTT. :)
Index: FvwmCommand.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmCommand/FvwmCommand.c,v
retrieving revision 1.41
diff -u -r1.41 FvwmCommand.c
--- FvwmCommand.c	6 Jul 2003 14:34:07 -0000	1.41
+++ FvwmCommand.c	28 May 2004 05:15:08 -0000
@@ -56,7 +56,6 @@
 void sendit( char *cmd );
 void receive( void );
 static RETSIGTYPE sig_ttin(int);
-/* void sig_pipe( int ); */
 static RETSIGTYPE sig_quit(int);
 void usage(void);
 int  read_f(int fd, char *p, int len);
@@ -125,6 +124,7 @@
     sigaction(SIGHUP, &sigact, NULL);
     sigaction(SIGQUIT, &sigact, NULL);
     sigaction(SIGTERM, &sigact, NULL);
+    sigaction(SIGPIPE, &sigact, NULL);
   }
 #else
 #ifdef USE_BSD_SIGNALS
@@ -135,6 +135,7 @@
   signal(SIGHUP, sig_quit);
   signal(SIGQUIT, sig_quit);
   signal(SIGTERM, sig_quit);
+  signal(SIGPIPE, sig_quit);
   signal(SIGTTIN, sig_ttin);
   signal(SIGTTOU, sig_ttin);
 #ifdef HAVE_SIGINTERRUPT
@@ -142,6 +143,7 @@
   siginterrupt(SIGHUP, 1);
   siginterrupt(SIGQUIT, 1);
   siginterrupt(SIGTERM, 1);
+  siginterrupt(SIGPIPE, 1);
   siginterrupt(SIGTTIN, 0);
   siginterrupt(SIGTTOU, 0);
 #endif