The branch, master has been updated
       via  94d1dbbaf01acff05dc0237470268ec85d02fdbb (commit)
      from  f24eecffde12937103dfce9bf91a69742eb75b29 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 94d1dbbaf01acff05dc0237470268ec85d02fdbb
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Feb 4 22:35:23 2009 +0100

    Restore correct handling of "is_data_available" for the socket transport
    
    This fixes a valgrind error reading an uninitialized variable

-----------------------------------------------------------------------

Summary of changes:
 source3/rpc_server/srv_pipe_hnd.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/srv_pipe_hnd.c 
b/source3/rpc_server/srv_pipe_hnd.c
index fa38176..30d0cf4 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);
 }
 


-- 
Samba Shared Repository

Reply via email to