From 5c89d12ca43e7949ace93c75ce59ca9fc0606521 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 28 Mar 2012 12:35:09 +1100 Subject: build: Remove sys_ftruncate wrapper --- source3/include/proto.h | 1 - source3/lib/dbwrap/dbwrap_file.c | 4 ++-- source3/lib/system.c | 9 --------- source3/modules/vfs_default.c | 8 ++++---- source3/passdb/pdb_smbpasswd.c | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 0af512a7e4..430cfeb8cf 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -334,7 +334,6 @@ int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf, bool fake_dir_create_times); int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf, bool fake_dir_create_times); -int sys_ftruncate(int fd, SMB_OFF_T offset); int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len); int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len); SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence); diff --git a/source3/lib/dbwrap/dbwrap_file.c b/source3/lib/dbwrap/dbwrap_file.c index f7d207be7f..8e513b5ad2 100644 --- a/source3/lib/dbwrap/dbwrap_file.c +++ b/source3/lib/dbwrap/dbwrap_file.c @@ -209,8 +209,8 @@ static NTSTATUS db_file_store_root(int fd, TDB_DATA data) return map_nt_error_from_unix(errno); } - if (sys_ftruncate(fd, data.dsize) != 0) { - DEBUG(3, ("sys_ftruncate failed: %s\n", strerror(errno))); + if (ftruncate(fd, data.dsize) != 0) { + DEBUG(3, ("ftruncate failed: %s\n", strerror(errno))); return map_nt_error_from_unix(errno); } diff --git a/source3/lib/system.c b/source3/lib/system.c index feb745306a..1e2c30db2f 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -584,15 +584,6 @@ int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OF #endif } -/******************************************************************* - An ftruncate() wrapper. -********************************************************************/ - -int sys_ftruncate(int fd, SMB_OFF_T offset) -{ - return ftruncate(fd, offset); -} - /******************************************************************* An lseek() wrapper. ********************************************************************/ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 568f346452..f5a64759be 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1386,7 +1386,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs /* Shrink - just ftruncate. */ if (pst->st_ex_size > len) - return sys_ftruncate(fsp->fh->fd, len); + return ftruncate(fsp->fh->fd, len); space_to_write = len - pst->st_ex_size; @@ -1444,12 +1444,12 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O } /* we used to just check HAVE_FTRUNCATE_EXTEND and only use - sys_ftruncate if the system supports it. Then I discovered that + ftruncate if the system supports it. Then I discovered that you can have some filesystems that support ftruncate expansion and some that don't! On Linux fat can't do ftruncate extend but ext2 can. */ - result = sys_ftruncate(fsp->fh->fd, len); + result = ftruncate(fsp->fh->fd, len); if (result == 0) goto done; @@ -1480,7 +1480,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O } if (pst->st_ex_size > len) { - /* the sys_ftruncate should have worked */ + /* the ftruncate should have worked */ goto done; } diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index c1dabc4dff..789374a75f 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -706,7 +706,7 @@ Error was %s\n", newpwd->smb_name, pfile, strerror(errno))); Error was %s\n", wr_len, newpwd->smb_name, pfile, strerror(errno))); /* Remove the entry we just wrote. */ - if(sys_ftruncate(fd, offpos) == -1) { + if(ftruncate(fd, offpos) == -1) { DEBUG(0, ("add_smbfilepwd_entry: ERROR failed to ftruncate file %s. \ Error was %s. Password file may be corrupt ! Please examine by hand !\n", newpwd->smb_name, strerror(errno))); -- cgit