[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5348-g7fd407f

Karolin Seeger kseeger at samba.org
Tue Sep 8 01:45:31 MDT 2009


The branch, v3-3-test has been updated
       via  7fd407fefe92939ecb78400d22aac55590851f70 (commit)
      from  39a7cc3c1fd6a3fbb56c8030b6e12962d9fb7181 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 7fd407fefe92939ecb78400d22aac55590851f70
Author: Simo Sorce <idra at samba.org>
Date:   Sat Sep 5 10:18:12 2009 -0400

    Check we read off the compelte event from inotify
    
    The kernel may return a short read, so we must use read_data() to make sure we
    read off the full buffer. If somethign bad happens we also need to kill the
    inotify watch because the filedescriptor will return out of sync structures if
    we read only part of the data.
    
    Fixes bug #6693.

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

Summary of changes:
 source/smbd/notify_inotify.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/notify_inotify.c b/source/smbd/notify_inotify.c
index 8237e4a..a12c0a6 100644
--- a/source/smbd/notify_inotify.c
+++ b/source/smbd/notify_inotify.c
@@ -232,6 +232,7 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde,
 	int bufsize = 0;
 	struct inotify_event *e0, *e;
 	uint32_t prev_cookie=0;
+	NTSTATUS status;
 
 	/*
 	  we must use FIONREAD as we cannot predict the length of the
@@ -247,9 +248,14 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde,
 	e0 = e = (struct inotify_event *)TALLOC_SIZE(in, bufsize);
 	if (e == NULL) return;
 
-	if (sys_read(in->fd, e0, bufsize) != bufsize) {
-		DEBUG(0,("Failed to read all inotify data\n"));
+	status = read_data(in->fd, (char *)e0, bufsize);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(0,("Failed to read all inotify data - %s\n",
+			nt_errstr(status)));
 		talloc_free(e0);
+		/* the inotify fd will now be out of sync,
+		 * can't keep reading data off it */
+		TALLOC_FREE(fde);
 		return;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list