From: Michal Vaner Date: Mon, 9 Mar 2009 17:58:01 +0000 (+0100) Subject: Make selfpipe read/write errors nonfatal X-Git-Tag: holmes-import~28^2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=90c18c6f5e7a65f5ecf64392e6a4aa432ed325f5;p=libucw.git Make selfpipe read/write errors nonfatal die in signal handler is unsafe and the errors should not cause anything really bad anyway. --- diff --git a/ucw/mainloop.c b/ucw/mainloop.c index c348ecd1..92a1cc1c 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -259,7 +259,7 @@ main_sigchld_handler(int x UNUSED) ssize_t result; while((result = write(sig_pipe_send, "c", 1)) == -1 && errno == EINTR); if(result == -1 && errno != EAGAIN) - die("Could not write to selfpipe: %m"); + msg(L_SIGHANDLER|L_ERROR, "Could not write to self-pipe: %m"); errno = old_errno; } @@ -268,8 +268,8 @@ dummy_read_handler(struct main_file *mp) { char buffer[1024]; ssize_t result = read(mp->fd, buffer, 1024); - if(result == -1 && errno != EAGAIN && errno != EINTR) - die("Could not read from selfpipe: %m"); + if(result == -1 && errno != EAGAIN) + msg(L_ERROR, "Could not read from selfpipe: %m"); file_chg(mp); return result == 1024; }