diff options
author | Nadezhda Ivanova <nadezhda.ivanova@postpath.com> | 2009-09-21 14:26:15 -0700 |
---|---|---|
committer | Nadezhda Ivanova <nadezhda.ivanova@postpath.com> | 2009-09-21 14:26:15 -0700 |
commit | 13b979b03d86f3ae43dc5fd539fa5d3f22f579a0 (patch) | |
tree | 40e15be25f6b975e7c5b91f00fdf6030726e25e7 /source3/winbindd/winbindd.c | |
parent | 025590e7a4758e86e7942642971b92fc6bab7a8e (diff) | |
parent | 1afc7c453c1d5f7e761e46cdc69900305a149820 (diff) | |
download | samba-13b979b03d86f3ae43dc5fd539fa5d3f22f579a0.tar.gz samba-13b979b03d86f3ae43dc5fd539fa5d3f22f579a0.tar.bz2 samba-13b979b03d86f3ae43dc5fd539fa5d3f22f579a0.zip |
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'source3/winbindd/winbindd.c')
-rw-r--r-- | source3/winbindd/winbindd.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 9d4676f9b5..f0160fcb78 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -692,6 +692,8 @@ static void winbind_client_response_written(struct tevent_req *req) ret = wb_resp_write_recv(req, &err); TALLOC_FREE(req); if (ret == -1) { + close(state->sock); + state->sock = -1; DEBUG(2, ("Could not write response to client: %s\n", strerror(err))); remove_client(state); @@ -792,6 +794,8 @@ static void winbind_client_request_read(struct tevent_req *req) ret = wb_req_read_recv(req, state, &state->request, &err); TALLOC_FREE(req); if (ret == -1) { + close(state->sock); + state->sock = -1; DEBUG(2, ("Could not read client request: %s\n", strerror(err))); remove_client(state); @@ -813,22 +817,19 @@ static void remove_client(struct winbindd_cli_state *state) return; } - /* tell client, we are closing ... */ - nwritten = write(state->sock, &c, sizeof(c)); - if (nwritten == -1) { - /* - * ignore EPIPE error here, because the other end might - * have already closed the socket. - */ - if (errno != EPIPE) { + if (state->sock != -1) { + /* tell client, we are closing ... */ + nwritten = write(state->sock, &c, sizeof(c)); + if (nwritten == -1) { DEBUG(2, ("final write to client failed: %s\n", - strerror(errno))); + strerror(errno))); } - } - /* Close socket */ + /* Close socket */ - close(state->sock); + close(state->sock); + state->sock = -1; + } /* Free any getent state */ |