diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-06 07:58:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:33 -0500 |
commit | 439c1524fba3b58abe9e353f9ff2bd7f103f3d12 (patch) | |
tree | 0b824442f7c57ee4a2653fbcbb280987cb582e01 /source4/ntvfs/posix/pvfs_setfileinfo.c | |
parent | 4c06ac06a13eaff5b314ad97cce824d615c06f9a (diff) | |
download | samba-439c1524fba3b58abe9e353f9ff2bd7f103f3d12.tar.gz samba-439c1524fba3b58abe9e353f9ff2bd7f103f3d12.tar.xz samba-439c1524fba3b58abe9e353f9ff2bd7f103f3d12.zip |
r3573: added trans2open support to smbd and pvfs, and fine-tuned the open->generic ntvfs mapping code.
(This used to be commit ed844192d7f7ed487290f719df65f256a5b0b9bc)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_setfileinfo.c')
-rw-r--r-- | source4/ntvfs/posix/pvfs_setfileinfo.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index e570743abac..22997be94d2 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -188,10 +188,16 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs, /* possibly change the file size */ if (newstats.st.st_size != f->name->st.st_size) { + int ret; if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { return NT_STATUS_FILE_IS_A_DIRECTORY; } - if (ftruncate(f->fd, newstats.st.st_size) == -1) { + if (f->access_mask & SA_RIGHT_FILE_WRITE_APPEND) { + ret = ftruncate(f->fd, newstats.st.st_size); + } else { + ret = truncate(f->name->full_name, newstats.st.st_size); + } + if (ret == -1) { return pvfs_map_errno(pvfs, errno); } } |