summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-08-06 17:49:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:18 -0500
commite0475afa8375eb27795aaecca16f8ae6f98666e7 (patch)
treea69314c3e78028ebe86e725a9fc06c5efc9c94b7 /source3
parent161d3eeb4b6e32fda6ba9eabad54bf7d8dc43e54 (diff)
downloadsamba-e0475afa8375eb27795aaecca16f8ae6f98666e7.tar.gz
samba-e0475afa8375eb27795aaecca16f8ae6f98666e7.tar.bz2
samba-e0475afa8375eb27795aaecca16f8ae6f98666e7.zip
r1665: Patch from James Peach @ SGI to stop using sendfile if it isn't
supported by the underlying OS. Jeremy. (This used to be commit 1b0c70cf97aa45093fe5ef866a351b47ef1a5879)
Diffstat (limited to 'source3')
-rw-r--r--source3/param/loadparm.c12
-rw-r--r--source3/smbd/reply.c8
2 files changed, 18 insertions, 2 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 549e232fe0..4150f57e55 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -4324,6 +4324,18 @@ BOOL lp_use_sendfile(int snum)
}
/*******************************************************************
+ 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.
********************************************************************/
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index f3ab709df4..4125d71b84 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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) ));