Changeset e2cc848


Ignore:
Timestamp:
May 23, 2011, 8:57:46 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
1491439
Parents:
81db142
git-author:
David Benjamin <davidben@mit.edu> (02/26/11 20:35:26)
git-committer:
David Benjamin <davidben@mit.edu> (05/23/11 20:57:46)
Message:
Just ignore SIGPIPE altogether

There's not much point in switching back and forth from ignoring it and
mostly ignoring it. Also, we don't handle SIGCHLD so remove the code for
it.

(We actually also disable it in the Jabber module because XML::Stream
sets $SIG{PIPE}. Meh.)
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • filterproc.c

    rd564c3d re2cc848  
    1717  int err = 0;
    1818  struct pollfd fds[2];
    19   struct sigaction sig = {.sa_handler = SIG_IGN}, old;
    2019
    2120  fcntl(rfd, F_SETFL, O_NONBLOCK | fcntl(rfd, F_GETFL));
     
    2726  fds[1].events = POLLOUT;
    2827
    29   sigaction(SIGPIPE, &sig, &old);
    30  
    3128  while(1) {
    3229    if(out && *out) {
     
    6764
    6865  *in = g_string_free(str, err < 0);
    69   sigaction(SIGPIPE, &old, NULL);
    7066  return err;
    7167}
  • owl.c

    r81db142 re2cc848  
    358358
    359359  owl_function_debugmsg("Got signal %d", sig);
    360   /* TODO: These don't need to be re-entrant anymore! */
    361360  if (sig == SIGWINCH) {
    362     /* we can't inturrupt a malloc here, so it just sets a flag
    363      * schedulding a resize for later
    364      */
    365361    owl_function_resize();
    366   } else if (sig == SIGPIPE || sig == SIGCHLD) {
    367     owl_function_error("Got unexpected signal: %d %s",
    368                        sig, (sig == SIGPIPE) ? "SIGPIPE" : "SIGCHLD");
    369362  } else if (sig == SIGTERM || sig == SIGHUP) {
    370363    owl_function_quit();
     
    394387
    395388void owl_register_signal_handlers(void) {
     389  struct sigaction ignore = { .sa_handler = SIG_IGN };
    396390  sigset_t sigset;
    397391
     392  /* Turn off SIGPIPE; we check the return value of write. */
     393  sigaction(SIGPIPE, &ignore, NULL);
     394
     395  /* Register some signals with the signal thread. */
    398396  sigemptyset(&sigset);
    399397  sigaddset(&sigset, SIGWINCH);
    400398  sigaddset(&sigset, SIGALRM);
    401   sigaddset(&sigset, SIGPIPE);
    402399  sigaddset(&sigset, SIGTERM);
    403400  sigaddset(&sigset, SIGHUP);
    404401  sigaddset(&sigset, SIGINT);
    405 
    406402  owl_signal_init(&sigset, sig_handler, g_main_context_default());
    407403}
Note: See TracChangeset for help on using the changeset viewer.