Re: ignore(SIGPIPE) in gsm

Miguel de Icaza wrote:
> Now, an alternative approach is to make SIGPIPE point to a signal
> handler (this way it will get reset over forks).  The signal handler
> will just make write return EPIPE on failure.

Yes, that's the right approach. You can see it in enlightenment
(src/setup.c). Insted of handling SIGPIPE with SIG_IGN which is not real
handler (it doesn't get reset on fork) you can put dummy handler with
nothing but return in it. Something like:

/* Code begin */

handle_sig_pipe (int i)


  struct sigaction act;

  act.sa_handler = handle_sig_pipe;
  sigemptyset (&act.sa_mask);
  act.sa_flags = 0;

  sigaction (SIGPIPE, &act, NULL);

/* Code end */

instead ignoring SIGPIPE. This will not cross borders of fork and will
not give you trouble whith extra checking. At least I hope so :-).

There is a patch attached for gnome-session to handle SIGPIPE this way.
I'll try to make a similar one for the Orbit if you agree with Miguel

Index: main.c
RCS file: /cvs/gnome/gnome-core/gsm/main.c,v
retrieving revision 1.11
diff -u -r1.11 main.c
--- main.c	1999/01/23 16:09:52	1.11
+++ main.c	1999/03/10 01:47:38
@@ -49,11 +49,17 @@
 /* A separate function to ease the impending #if hell.  */
 static void
+sig_ignore_handler (int num)
+  return;
+static void
 ignore (int sig)
   struct sigaction act;
-  act.sa_handler = SIG_IGN;
+  act.sa_handler = sig_ignore_handler;
   sigemptyset (& act.sa_mask);
   act.sa_flags = 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]