svn commit: samba r6580 - in branches/SAMBA_4_0/source/ntvfs/posix:
.
tridge at samba.org
tridge at samba.org
Mon May 2 15:59:35 GMT 2005
Author: tridge
Date: 2005-05-02 15:59:34 +0000 (Mon, 02 May 2005)
New Revision: 6580
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6580
Log:
fixed the bug that caused the truncation of the main file on a stream
open with openx and the 'truncate if exists' flag
Modified:
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c
Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2005-05-02 15:58:54 UTC (rev 6579)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2005-05-02 15:59:34 UTC (rev 6580)
@@ -856,7 +856,7 @@
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 @@
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 @@
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 @@
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 */
Modified: branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c 2005-05-02 15:58:54 UTC (rev 6579)
+++ branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c 2005-05-02 15:59:34 UTC (rev 6580)
@@ -37,7 +37,7 @@
#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;
}
More information about the samba-cvs
mailing list