s3: tevent_req_poll() loops forever when pipe is broken
[idra/samba.git] / source3 / libsmb / async_smb.c
index 7afba0dae991d696b316677d9cfc2073391772fb..96b7054b8730d757b6898d5dc7f5a61926fe77eb 100644 (file)
@@ -742,6 +742,10 @@ static void cli_smb_sent(struct tevent_req *subreq)
        nwritten = writev_recv(subreq, &err);
        TALLOC_FREE(subreq);
        if (nwritten == -1) {
+               if (err == EPIPE) {
+                       close(state->cli->fd);
+                       state->cli->fd = -1;
+               }
                tevent_req_nterror(req, map_nt_error_from_unix(err));
                return;
        }
@@ -787,6 +791,10 @@ static void cli_smb_received(struct tevent_req *subreq)
        received = read_smb_recv(subreq, talloc_tos(), &inbuf, &err);
        TALLOC_FREE(subreq);
        if (received == -1) {
+               if (err == EPIPE) {
+                       close(cli->fd);
+                       cli->fd = -1;
+               }
                status = map_nt_error_from_unix(err);
                goto fail;
        }