From f140bf2e6578e45b8603d4a6c5feef9a3b735804 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 18 May 2009 07:08:34 +0200 Subject: Fix broken pipe handling Metze is right: If we have *any* error at the socket level, we just can not continue. Also, apply some defensive programming: With this async stuff someone else might already have closed the socket. --- source3/libsmb/async_smb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 96b7054b87..12bc0a6fb3 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -742,7 +742,7 @@ static void cli_smb_sent(struct tevent_req *subreq) nwritten = writev_recv(subreq, &err); TALLOC_FREE(subreq); if (nwritten == -1) { - if (err == EPIPE) { + if (state->cli->fd != -1) { close(state->cli->fd); state->cli->fd = -1; } @@ -791,7 +791,7 @@ 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) { + if (cli->fd != -1) { close(cli->fd); cli->fd = -1; } -- cgit