Avoid non-portable signal(SIGCHLD, SIG_IGN)

Alexandre Julliard julliard at winehq.com
Wed Apr 16 21:50:15 CDT 2003


Gerald Pfeifer <pfeifer at dbai.tuwien.ac.at> writes:

> Unfortunately, a general patch for this is beyond my (current)
> capabilities, so I'd really appreciate could the two of you agree on
> a general fix for this.

Does this do the right thing on FreeBSD?

Index: scheduler/client.c
===================================================================
RCS file: /opt/cvs-commit/wine/scheduler/client.c,v
retrieving revision 1.97
diff -u -r1.97 client.c
--- scheduler/client.c	1 Apr 2003 04:39:35 -0000	1.97
+++ scheduler/client.c	17 Apr 2003 02:45:46 -0000
@@ -672,11 +672,19 @@
     TEB *teb = NtCurrentTeb();
     int version, ret;
     int reply_pipe[2];
+    struct sigaction sig_act;
+
+    sig_act.sa_handler = SIG_IGN;
+    sig_act.sa_flags   = 0;
+    sigemptyset( &sig_act.sa_mask );
 
     /* ignore SIGPIPE so that we get a EPIPE error instead  */
-    signal( SIGPIPE, SIG_IGN );
+    sigaction( SIGPIPE, &sig_act, NULL );
     /* automatic child reaping to avoid zombies */
-    signal( SIGCHLD, SIG_IGN );
+#ifdef SA_NOCLDWAIT
+    sig_act.sa_flags |= SA_NOCLDWAIT;
+#endif
+    sigaction( SIGCHLD, &sig_act, NULL );
 
     /* create the server->client communication pipes */
     if (pipe( reply_pipe ) == -1) server_protocol_perror( "pipe" );

-- 
Alexandre Julliard
julliard at winehq.com



More information about the wine-devel mailing list