Commit Diff


commit - b883aee3556b3841004d3b1ec76cb0d26de420b0
commit + 1bd35332a599d65566a5fab8c0ff0eb6201812ff
blob - 77be7d3f23878f357a4e133557280d9e062ceaa9
blob + 19d26f357f398508ab9a9cc21ebd763ddea506cd
--- gotd/notify.c
+++ gotd/notify.c
@@ -355,9 +355,9 @@ notify_dispatch_session(int fd, short event, void *arg
 
 	if (event & EV_WRITE) {
 		n = msgbuf_write(&ibuf->w);
-		if (n == -1 && errno != EAGAIN)
+		if (n == -1 && errno != EAGAIN && errno != EPIPE)
 			fatal("msgbuf_write");
-		if (n == 0) {
+		if (n == 0 || (n == -1 && errno == EPIPE)) {
 			/* Connection closed. */
 			shut = 1;
 			goto done;
@@ -454,9 +454,9 @@ notify_dispatch(int fd, short event, void *arg)
 
 	if (event & EV_WRITE) {
 		n = msgbuf_write(&ibuf->w);
-		if (n == -1 && errno != EAGAIN)
+		if (n == -1 && errno != EAGAIN && errno != EPIPE)
 			fatal("msgbuf_write");
-		if (n == 0) {
+		if (n == 0 || (n == -1 && errno == EPIPE)) {
 			/* Connection closed. */
 			shut = 1;
 			goto done;