summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-05-08 23:16:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:50 -0500
commit08355754151b2d02b2102bc76e94b63ffffdf408 (patch)
tree34b532b71a0a6245716c16b9458d8decbbf3b604 /source3/smbd/reply.c
parent23320ad0e3992b9e25407c1acaf99db4722b916e (diff)
downloadsamba-08355754151b2d02b2102bc76e94b63ffffdf408.tar.gz
samba-08355754151b2d02b2102bc76e94b63ffffdf408.tar.bz2
samba-08355754151b2d02b2102bc76e94b63ffffdf408.zip
r6673: Fix the write cache based on some VERY good detective work
from Ingo Kilian <ikilian@web.de>. You must do a make clean after updating this. Jeremy. (This used to be commit 3b2cd19fcb8ce38578b122fd6ae722b73081dcda)
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e1131c56ed..686f54c5e7 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2190,21 +2190,18 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
maxcount = MIN(65535,maxcount);
if (!is_locked(fsp,conn,(SMB_BIG_UINT)maxcount,(SMB_BIG_UINT)startpos, READ_LOCK)) {
- SMB_OFF_T size = fsp->size;
- SMB_OFF_T sizeneeded = startpos + maxcount;
+ SMB_STRUCT_STAT st;
+ SMB_OFF_T size = 0;
- if (size < sizeneeded) {
- SMB_STRUCT_STAT st;
- if (SMB_VFS_FSTAT(fsp,fsp->fd,&st) == 0)
- size = st.st_size;
- if (!fsp->can_write)
- fsp->size = size;
+ if (SMB_VFS_FSTAT(fsp,fsp->fd,&st) == 0) {
+ size = st.st_size;
}
- if (startpos >= size)
+ if (startpos >= size) {
nread = 0;
- else
+ } else {
nread = MIN(maxcount,(size - startpos));
+ }
}
#if 0 /* mincount appears to be ignored in a W2K server. JRA. */