chiark / gitweb /
SIGPIPE protection available.
[adns.git] / src / event.c
index 5041f8ce02bc6cf23e69b52c214de682869330b1..db3dad68e776168a2c645aa14e801413cf837dd7 100644 (file)
@@ -284,7 +284,9 @@ static int internal_callback(adns_state ads, int maxfd,
     } else if (callb_checkfd(maxfd,exceptfds,ads->tcpsocket)) {
       adns__tcp_broken(ads,"select","exceptional condition detected");
     } else if (ads->tcpsend.used && callb_checkfd(maxfd,writefds,ads->tcpsocket)) {
+      adns__sigpipe_protect(ads);
       r= write(ads->tcpsocket,ads->tcpsend.buf,ads->tcpsend.used);
+      adns__sigpipe_unprotect(ads);
       if (r<0) {
        if (errno!=EAGAIN && errno!=EWOULDBLOCK && errno!=ENOMEM && errno!=EINTR) {
          adns__tcp_broken(ads,"write",strerror(errno));