Branch: Tag:

2015-10-22

2015-10-22 09:18:59 by Henrik Grubbström (Grubba) <grubba@grubba.org>

I/O: Make sure to ignore SIGPIPE.

Under some circumstances Stdio.sendfile() will use blocking I/O.
If the other end then closes the connection before all data is
sent sendfile() will fail with EPIPE and kill us with SIGPIPE.
We don't want to die...

Fixes some of [bug 7582 (#7582)].

6:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.715 2001/08/24 17:35:49 mast Exp $"; + constant cvs_version="$Id$";      // The argument cache. Used by the image cache.   ArgCache argcache;
4043:    }   #endif    +  // Signals which need to be ignored +  foreach( ({ "SIGPIPE" }), string sig) +  catch( signal(signum(sig), 0) ); +     // Signals which cause a restart (exitcode != 0)    foreach( ({ "SIGINT", "SIGTERM" }), string sig)    catch( signal(signum(sig), async_sig_start(exit_when_done,0)) );