summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-02-04 22:35:23 +0100
committerVolker Lendecke <vl@samba.org>2009-02-04 22:36:43 +0100
commit94d1dbbaf01acff05dc0237470268ec85d02fdbb (patch)
treef86086e0bb2364515b166714898b82dfc6534bc4 /source3/rpc_server
parentf24eecffde12937103dfce9bf91a69742eb75b29 (diff)
downloadsamba-94d1dbbaf01acff05dc0237470268ec85d02fdbb.tar.gz
samba-94d1dbbaf01acff05dc0237470268ec85d02fdbb.tar.bz2
samba-94d1dbbaf01acff05dc0237470268ec85d02fdbb.zip
Restore correct handling of "is_data_available" for the socket transport
This fixes a valgrind error reading an uninitialized variable
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index fa38176749..30d0cf408f 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -1221,6 +1221,7 @@ NTSTATUS np_write_recv(struct async_req *req, ssize_t *pnwritten)
struct np_read_state {
ssize_t nread;
bool is_data_outstanding;
+ int fd;
};
static void np_read_done(struct async_req *subreq);
@@ -1255,6 +1256,7 @@ struct async_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
handle->private_data, struct np_proxy_state);
state->nread = len;
+ state->fd = p->fd;
subreq = recvall_send(state, ev, p->fd, data, len, 0);
if (subreq == NULL) {
@@ -1279,13 +1281,24 @@ static void np_read_done(struct async_req *subreq)
{
struct async_req *req = talloc_get_type_abort(
subreq->async.priv, struct async_req);
+ struct np_read_state *state = talloc_get_type_abort(
+ req->private_data, struct np_read_state);
NTSTATUS status;
+ int available = 0;
status = recvall_recv(subreq);
if (!NT_STATUS_IS_OK(status)) {
async_req_nterror(req, status);
return;
}
+
+ /*
+ * We don't look at the ioctl result. We don't really care if there is
+ * data available, because this is racy anyway.
+ */
+ ioctl(state->fd, FIONREAD, &available);
+ state->is_data_outstanding = (available > 0);
+
async_req_done(req);
}