]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r1665: Patch from James Peach @ SGI to stop using sendfile if it isn't
authorJeremy Allison <jra@samba.org>
Fri, 6 Aug 2004 17:49:00 +0000 (17:49 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:18 +0000 (10:52 -0500)
supported by the underlying OS.
Jeremy.

source/param/loadparm.c
source/smbd/reply.c

index 549e232fe07d7f4361fc5aae84d2b3572aec0f9a..4150f57e55d20ca464d1e1d4f4e5650899abdbf7 100644 (file)
@@ -4323,6 +4323,18 @@ BOOL lp_use_sendfile(int snum)
        return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !srv_is_signing_active());
 }
 
+/*******************************************************************
+ Turn off sendfile if we find the underlying OS doesn't support it.
+********************************************************************/
+
+void set_use_sendfile(int snum, BOOL val)
+{
+       if (LP_SNUM_OK(snum))
+               ServicePtrs[snum]->bUseSendfile = val;
+       else
+               sDefault.bUseSendfile = val;
+}
+
 /*******************************************************************
  Turn off storing DOS attributes if this share doesn't support it.
 ********************************************************************/
index f3ab709df48e8be0601ed4a012d6fcc0492fecc0..4125d71b8404920e885438eac6f6caa4222fb1d6 100644 (file)
@@ -1748,8 +1748,10 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st
                         * Special hack for broken Linux with no 64 bit clean sendfile. If we
                         * return ENOSYS then pretend we just got a normal read.
                         */
-                       if (errno == ENOSYS)
+                       if (errno == ENOSYS) {
+                               set_use_sendfile(SNUM(conn), False);
                                goto normal_read;
+                       }
 
                        DEBUG(0,("send_file_readbraw: sendfile failed for file %s (%s). Terminating\n",
                                fsp->fsp_name, strerror(errno) ));
@@ -2111,8 +2113,10 @@ int send_file_readX(connection_struct *conn, char *inbuf,char *outbuf,int length
                         * Special hack for broken Linux with no 64 bit clean sendfile. If we
                         * return ENOSYS then pretend we just got a normal read.
                         */
-                       if (errno == ENOSYS)
+                       if (errno == ENOSYS) {
+                               set_use_sendfile(SNUM(conn), False);
                                goto normal_read;
+                       }
 
                        DEBUG(0,("send_file_readX: sendfile failed for file %s (%s). Terminating\n",
                                fsp->fsp_name, strerror(errno) ));