chiark / gitweb /
In signal handler, crash if write() fails in an unexpected way
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Dec 2015 01:45:00 +0000 (01:45 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Dec 2015 01:45:00 +0000 (01:45 +0000)
statemc.c

index cb5139d..b068722 100644 (file)
--- a/statemc.c
+++ b/statemc.c
@@ -546,7 +546,8 @@ static void sigarrived_handler(int signum) {
   default:
     abort();
   }
-  write(signal_self_pipe[1],&x,1);
+  int r = write(signal_self_pipe[1],&x,1);
+  if (!(r==1 || isewouldblock(errno))) abort();
   errno = esave;
 }