summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-10-30 17:42:02 -0700
committerJeremy Allison <jra@samba.org>2007-10-30 17:42:02 -0700
commit360c02328faf6fd64edebc8f3d499cee54753aeb (patch)
tree15a83c090374766f33cef159443ca4c9ba86270a
parentc3250149e12338fac5093991b385ad2807c92d1f (diff)
downloadsamba-360c02328faf6fd64edebc8f3d499cee54753aeb.tar.gz
samba-360c02328faf6fd64edebc8f3d499cee54753aeb.tar.bz2
samba-360c02328faf6fd64edebc8f3d499cee54753aeb.zip
Ensure we don't prematurely clean out the bytes read.
Jeremy. (This used to be commit 247675695dfbff503b5792de62f8bb1567ea2327)
-rw-r--r--source3/smbd/vfs.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index c1c1939153..21a12ae766 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -428,12 +428,15 @@ ssize_t vfs_write_data(struct smb_request *req,
if (req && req->unread_bytes) {
SMB_ASSERT(req->unread_bytes == N);
- req->unread_bytes = 0;
- return SMB_VFS_RECVFILE(smbd_server_fd(),
+ ret = SMB_VFS_RECVFILE(smbd_server_fd(),
fsp,
fsp->fh->fd,
(SMB_OFF_T)-1,
N);
+ if (ret != -1) {
+ req->unread_bytes = 0;
+ }
+ return ret;
}
while (total < N) {
@@ -460,12 +463,15 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
if (req && req->unread_bytes) {
SMB_ASSERT(req->unread_bytes == N);
- req->unread_bytes = 0;
- return SMB_VFS_RECVFILE(smbd_server_fd(),
+ ret = SMB_VFS_RECVFILE(smbd_server_fd(),
fsp,
fsp->fh->fd,
offset,
N);
+ if (ret != -1) {
+ req->unread_bytes = 0;
+ }
+ return ret;
}
while (total < N) {