]> mj.ucw.cz Git - libucw.git/commitdiff
Make selfpipe read/write errors nonfatal
authorMichal Vaner <vorner@ucw.cz>
Mon, 9 Mar 2009 17:58:01 +0000 (18:58 +0100)
committerMichal Vaner <vorner@ucw.cz>
Mon, 9 Mar 2009 17:58:01 +0000 (18:58 +0100)
die in signal handler is unsafe and the errors should not cause anything
really bad anyway.

ucw/mainloop.c

index c348ecd1dfda29e79ab36dedc4db430ad55c4b87..92a1cc1cd6ee5b7547714077f09d834cc12c498a 100644 (file)
@@ -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;
 }