diff options
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/posix/pvfs_flush.c | 3 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_resolve.c | 10 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_setfileinfo.c | 7 |
3 files changed, 18 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/pvfs_flush.c b/source4/ntvfs/posix/pvfs_flush.c index 49eaa74cfb..43893af80d 100644 --- a/source4/ntvfs/posix/pvfs_flush.c +++ b/source4/ntvfs/posix/pvfs_flush.c @@ -28,6 +28,9 @@ */ static void pvfs_flush_file(struct pvfs_state *pvfs, struct pvfs_file *f) { + if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { + return; + } if (pvfs->flags & PVFS_FLAG_STRICT_SYNC) { fsync(f->fd); } diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index 75fbeb39a5..be1662437e 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -510,8 +510,14 @@ NTSTATUS pvfs_resolve_name_fd(struct pvfs_state *pvfs, int fd, inode = name->st.st_ino; } - if (fstat(fd, &name->st) == -1) { - return NT_STATUS_INVALID_HANDLE; + if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { + if (stat(name->full_name, &name->st) == -1) { + return NT_STATUS_INVALID_HANDLE; + } + } else { + if (fstat(fd, &name->st) == -1) { + return NT_STATUS_INVALID_HANDLE; + } } if (name->exists && diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index bba3ee3747..bc96f25fec 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -128,6 +128,9 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs, /* possibly change the file size */ if (newstats.st.st_size != f->name->st.st_size) { + if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { + return NT_STATUS_FILE_IS_A_DIRECTORY; + } if (ftruncate(f->fd, newstats.st.st_size) == -1) { return pvfs_map_errno(pvfs, errno); } @@ -150,6 +153,10 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs, /* possibly change the attribute */ if (newstats.dos.attrib != f->name->dos.attrib) { mode_t mode = pvfs_fileperms(pvfs, newstats.dos.attrib); + if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { + /* ignore on directories for now */ + return NT_STATUS_OK; + } if (fchmod(f->fd, mode) == -1) { return pvfs_map_errno(pvfs, errno); } |