lib/async_req: Retry read_packet with read(2)
authorVolker Lendecke <vl@samba.org>
Fri, 23 Mar 2012 14:56:43 +0000 (15:56 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 23 Mar 2012 16:31:24 +0000 (17:31 +0100)
This way it will also work with pipes

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 23 17:31:24 CET 2012 on sn-devel-104

lib/async_req/async_sock.c

index 545d21378fa1b7a082763231ec639b8ba41d200b..9909bc6eb3a32511975bf6ee02c89c6db7274d2e 100644 (file)
@@ -596,6 +596,10 @@ static void read_packet_handler(struct tevent_context *ev,
 
        nread = recv(state->fd, state->buf+state->nread, total-state->nread,
                     0);
+       if ((nread == -1) && (errno == ENOTSOCK)) {
+               nread = read(state->fd, state->buf+state->nread,
+                            total-state->nread);
+       }
        if ((nread == -1) && (errno == EINTR)) {
                /* retry */
                return;