The branch, v3-6-test has been updated via 9a04ae2 Replace lseek()/write()/lseek() triple with pwrite call. We already emulate this inside pwrite under the covers. from e6124ea posix_fallocate() returns an errno, not -1 on error. (cherry picked from commit 54df836341b170c58e99f65fa4c822a83ea9f05d)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 9a04ae232a3da869526834a41178e5ab660e924c Author: Jeremy Allison <j...@samba.org> Date: Thu Dec 2 17:52:11 2010 -0800 Replace lseek()/write()/lseek() triple with pwrite call. We already emulate this inside pwrite under the covers. Jeremy. (cherry picked from commit 6a528564cb2f19905b3d4380bcad05f5c6ef8550) ----------------------------------------------------------------------- Summary of changes: source3/modules/vfs_default.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 79f66db..648aa34 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -886,7 +886,6 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O int result = -1; SMB_STRUCT_STAT st; char c = 0; - SMB_OFF_T currpos; START_PROFILE(syscall_ftruncate); @@ -909,10 +908,6 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot extend a file with ftruncate. Provide alternate implementation for this */ - currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); - if (currpos == -1) { - goto done; - } /* Do an fstat to see if the file is longer than the requested size in which case the ftruncate above should have @@ -939,15 +934,10 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O goto done; } - if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1) - goto done; - - if (SMB_VFS_WRITE(fsp, &c, 1)!=1) + if (SMB_VFS_PWRITE(fsp, &c, 1, len-1)!=1) { goto done; + } - /* Seek to where we were */ - if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos) - goto done; result = 0; done: -- Samba Shared Repository