summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c26
-rw-r--r--source4/ntvfs/posix/xattr_system.c2
2 files changed, 21 insertions, 7 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index e68670f7cc..4a2c8ea247 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -856,7 +856,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
uint32_t create_options;
uint32_t share_access;
uint32_t access_mask;
- BOOL stream_existed;
+ BOOL stream_existed, stream_truncate=False;
/* use the generic mapping code to avoid implementing all the
different open calls. */
@@ -892,13 +892,16 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return NT_STATUS_INVALID_PARAMETER;
}
+ flags = 0;
+
switch (io->generic.in.open_disposition) {
case NTCREATEX_DISP_SUPERSEDE:
- flags = O_TRUNC;
- break;
-
case NTCREATEX_DISP_OVERWRITE_IF:
- flags = O_TRUNC;
+ if (name->stream_name == NULL) {
+ flags = O_TRUNC;
+ } else {
+ stream_truncate = True;
+ }
break;
case NTCREATEX_DISP_OPEN:
@@ -912,7 +915,11 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
if (!name->stream_exists) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
- flags = O_TRUNC;
+ if (name->stream_name == NULL) {
+ flags = O_TRUNC;
+ } else {
+ stream_truncate = True;
+ }
break;
case NTCREATEX_DISP_CREATE:
@@ -1075,6 +1082,13 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
talloc_free(lck);
return status;
}
+ if (stream_truncate) {
+ status = pvfs_stream_truncate(pvfs, f->handle->name, fd, 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(lck);
+ return status;
+ }
+ }
}
/* re-resolve the open fd */
diff --git a/source4/ntvfs/posix/xattr_system.c b/source4/ntvfs/posix/xattr_system.c
index 3b8becf6fe..4101b69ed7 100644
--- a/source4/ntvfs/posix/xattr_system.c
+++ b/source4/ntvfs/posix/xattr_system.c
@@ -37,7 +37,7 @@ NTSTATUS pull_xattr_blob_system(struct pvfs_state *pvfs,
#if HAVE_XATTR_SUPPORT
int ret;
- *blob = data_blob_talloc(mem_ctx, NULL, estimated_size);
+ *blob = data_blob_talloc(mem_ctx, NULL, estimated_size+16);
if (blob->data == NULL) {
return NT_STATUS_NO_MEMORY;
}