Only call sendfile_short_read() if we need it.
authorJeremy Allison <jra@samba.org>
Tue, 13 Jan 2009 23:36:09 +0000 (15:36 -0800)
committerJeremy Allison <jra@samba.org>
Tue, 13 Jan 2009 23:36:09 +0000 (15:36 -0800)
Jeremy.

source3/smbd/reply.c

index c8b8ec50e5771cefa55b27fc94d82108d6f39cdf..d7704965f8c98a331195e363c8b37916e28363e9 100644 (file)
@@ -2785,7 +2785,9 @@ void send_file_readbraw(connection_struct *conn,
                }
 
                /* Deal with possible short send. */
-               sendfile_short_send(fsp, sendfile_read, 4, nread);
+               if (sendfile_read != 4+nread) {
+                       sendfile_short_send(fsp, sendfile_read, 4, nread);
+               }
                return;
        }
 #endif
@@ -3278,7 +3280,9 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
                        fsp->fnum, (int)smb_maxcnt, (int)nread ) );
 
                /* Deal with possible short send. */
-               sendfile_short_send(fsp, nread, sizeof(headerbuf), smb_maxcnt);
+               if (nread != smb_maxcnt + sizeof(headerbuf)) {
+                       sendfile_short_send(fsp, nread, sizeof(headerbuf), smb_maxcnt);
+               }
 
                /* No outbuf here means successful sendfile. */
                TALLOC_FREE(req->outbuf);