summaryrefslogtreecommitdiff
path: root/source3/smbd/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/fileio.c')
-rw-r--r--source3/smbd/fileio.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 84339c3a6f..f395954d05 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -95,16 +95,14 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
flush_write_cache(fsp, READ_FLUSH);
- if (seek_file(fsp,pos) == -1) {
- DEBUG(3,("read_file: Failed to seek to %.0f\n",(double)pos));
- return(ret);
- }
-
+ fsp->pos = pos;
+
if (n > 0) {
#ifdef DMF_FIX
int numretries = 3;
tryagain:
- readret = SMB_VFS_READ(fsp,fsp->fd,data,n);
+ readret = SMB_VFS_PREAD(fsp,fsp->fd,data,n,pos);
+
if (readret == -1) {
if ((errno == EAGAIN) && numretries) {
DEBUG(3,("read_file EAGAIN retry in 10 seconds\n"));
@@ -115,7 +113,8 @@ tryagain:
return -1;
}
#else /* NO DMF fix. */
- readret = SMB_VFS_READ(fsp,fsp->fd,data,n);
+ readret = SMB_VFS_PREAD(fsp,fsp->fd,data,n,pos);
+
if (readret == -1)
return -1;
#endif
@@ -143,10 +142,12 @@ static ssize_t real_write_file(files_struct *fsp,char *data,SMB_OFF_T pos, size_
{
ssize_t ret;
- if ((pos != -1) && (seek_file(fsp,pos) == -1))
- return -1;
-
- ret = vfs_write_data(fsp,data,n);
+ if (pos == -1)
+ ret = vfs_write_data(fsp, data, n);
+ else {
+ fsp->pos = pos;
+ ret = vfs_pwrite_data(fsp, data, n, pos);
+ }
DEBUG(10,("real_write_file (%s): pos = %.0f, size = %lu, returned %ld\n",
fsp->fsp_name, (double)pos, (unsigned long)n, (long)ret ));