summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-05-28 13:09:11 +0200
committerStefan Metzmacher <metze@samba.org>2015-06-12 17:08:18 +0200
commit46e1aa22b12eacc3567f7897716ae07837545c23 (patch)
tree78c2110f49bd3861e4cc0e77c2610addaa953f4d /libcli
parent26c4b3fc9db507557b2539dd7d1f9e593c3fa35a (diff)
downloadsamba-46e1aa22b12eacc3567f7897716ae07837545c23.tar.gz
libcli/smb: close the socket fd at the end of smbXcli_conn_disconnect()
We need to cancel all pending requests before closing the socket fds, otherwise we cause problem with the interaction with the epoll event backend. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smbXcli_base.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index c2ba83af404..b38792e87be 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -997,15 +997,11 @@ static bool smbXcli_conn_receive_next(struct smbXcli_conn *conn)
void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status)
{
struct smbXcli_session *session;
+ int read_fd = conn->read_fd;
+ int write_fd = conn->write_fd;
tevent_queue_stop(conn->outgoing);
- if (conn->read_fd != -1) {
- close(conn->read_fd);
- }
- if (conn->write_fd != -1) {
- close(conn->write_fd);
- }
conn->read_fd = -1;
conn->write_fd = -1;
@@ -1088,6 +1084,13 @@ void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status)
}
TALLOC_FREE(chain);
}
+
+ if (read_fd != -1) {
+ close(read_fd);
+ }
+ if (write_fd != -1) {
+ close(write_fd);
+ }
}
/*