[SCM] Samba Shared Repository - branch v3-4-test updated - release-4-0-0alpha7-878-g651ae5c

Jeremy Allison jra at samba.org
Tue May 5 20:44:12 GMT 2009


The branch, v3-4-test has been updated
       via  651ae5c705c15c84882f6c1c3d73292794c63aa9 (commit)
      from  e606a32d2981a67290379e7b2d4da7237746731a (commit)

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


- Log -----------------------------------------------------------------
commit 651ae5c705c15c84882f6c1c3d73292794c63aa9
Author: Volker Lendecke <vl at samba.org>
Date:   Sat May 2 11:31:37 2009 +0200

    Fix bug 6302: Give the VFS a chance to read from 0-byte files

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

Summary of changes:
 source3/smbd/reply.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 5cdc59b..eb52ef3 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3263,14 +3263,13 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
 		return;
 	}
 
-	if (startpos > sbuf.st_size) {
-		smb_maxcnt = 0;
-	} else if (smb_maxcnt > (sbuf.st_size - startpos)) {
-		smb_maxcnt = (sbuf.st_size - startpos);
-	}
-
-	if (smb_maxcnt == 0) {
-		goto normal_read;
+	if (!S_ISREG(sbuf.st_mode) || (startpos > sbuf.st_size)
+	    || (smb_maxcnt > (sbuf.st_size - startpos))) {
+		/*
+		 * We already know that we would do a short read, so don't
+		 * try the sendfile() path.
+		 */
+		goto nosendfile_read;
 	}
 
 #if defined(WITH_SENDFILE)
@@ -3386,6 +3385,8 @@ normal_read:
 		return;
 	}
 
+nosendfile_read:
+
 	reply_outbuf(req, 12, smb_maxcnt);
 
 	nread = read_file(fsp, smb_buf(req->outbuf), startpos, smb_maxcnt);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list