timeout_begin(TIMEOUT);
        while(1) {
                res = send(fd, "A", 1, 0);
-               if (res == -1)
+               if (res == -1 && errno != EINTR)
                        break;
 
                /* Sleep a little before trying again to avoid flooding the
        }
        timeout_end();
 
+       if (errno != EPIPE) {
+               fprintf(stderr, "unexpected send(2) errno %d\n", errno);
+               exit(EXIT_FAILURE);
+       }
        if (!have_sigpipe) {
                fprintf(stderr, "SIGPIPE expected\n");
                exit(EXIT_FAILURE);
        timeout_begin(TIMEOUT);
        while(1) {
                res = send(fd, "A", 1, MSG_NOSIGNAL);
-               if (res == -1)
+               if (res == -1 && errno != EINTR)
                        break;
 
                timeout_usleep(SEND_SLEEP_USEC);
        }
        timeout_end();
 
+       if (errno != EPIPE) {
+               fprintf(stderr, "unexpected send(2) errno %d\n", errno);
+               exit(EXIT_FAILURE);
+       }
        if (have_sigpipe) {
                fprintf(stderr, "SIGPIPE not expected\n");
                exit(EXIT_FAILURE);