Signed-off-by: Stefan Metzmacher <metze@samba.org>
DEBUG(11, ("cli_state_handler called with flags %d\n", flags));
+ if (cli->fd == -1) {
+ status = NT_STATUS_CONNECTION_INVALID;
+ goto sock_error;
+ }
+
if (flags & EVENT_FD_WRITE) {
size_t to_send;
ssize_t sent;
}
}
TALLOC_FREE(cli->fd_event);
- close(cli->fd);
- cli->fd = -1;
+ if (cli->fd != -1) {
+ close(cli->fd);
+ cli->fd = -1;
+ }
}
static int rpc_transport_np_state_destructor(struct rpc_transport_np_state *s)
{
bool ret;
+
+ if (s->cli->fd == -1) {
+ DEBUG(10, ("socket was closed, no need to send close request.\n"));
+ return 0;
+ }
+
ret = cli_close(s->cli, s->fnum);
if (!ret) {
DEBUG(1, ("rpc_transport_np_state_destructor: cli_close "