Changeset b9c7424


Ignore:
Timestamp:
Mar 25, 2011, 3:55:41 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
8eb6068
Parents:
b929e35
git-author:
David Benjamin <davidben@mit.edu> (02/26/11 20:35:26)
git-committer:
David Benjamin <davidben@mit.edu> (03/25/11 03:55:41)
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 rb9c7424  
    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

    r37d188f rb9c7424  
    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();
     
    397390
    398391void owl_register_signal_handlers(void) {
     392  struct sigaction ignore = { .sa_handler = SIG_IGN };
    399393  sigset_t sigset;
    400394
     395  /* Turn off SIGPIPE; we check the return value of write. */
     396  sigaction(SIGPIPE, &ignore, NULL);
     397
     398  /* Register some signals with the signal thread. */
    401399  sigemptyset(&sigset);
    402400  sigaddset(&sigset, SIGWINCH);
    403401  sigaddset(&sigset, SIGALRM);
    404   sigaddset(&sigset, SIGPIPE);
    405402  sigaddset(&sigset, SIGTERM);
    406403  sigaddset(&sigset, SIGHUP);
    407404  sigaddset(&sigset, SIGINT);
    408 
    409405  owl_signal_init(&sigset, sig_handler, g_main_context_default());
    410406}
Note: See TracChangeset for help on using the changeset viewer.