vfs_streams_xattr: Do not attempt to write empty attribute twice
commit0b80e9376daf07089dac6221a51dff1ffee6cbac
authorChristof Schmitt <christof.schmitt@us.ibm.com>
Wed, 12 Jun 2013 21:55:15 +0000 (12 14:55 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 3 Jul 2013 10:22:43 +0000 (3 12:22 +0200)
tree262182598d40e43bcaf8e2ff2afaf160655eea9c
parentf695430ffb7bb036ffbfdbc5baafb8e8698670e8
vfs_streams_xattr: Do not attempt to write empty attribute twice

The create disposition FILE_OVERWRITE_IF is mapped to the flags
O_CREAT|O_TRUNC. In vfs_streams_xattr, this triggers two calls to
SMB_VFS_SETXATTR. The second can fail if O_EXCL is also set, resulting
in an unnecessary error.

Merge the identical code to handle O_CREAT and O_TRUNC to avoid setting
an empty attribute twice. Also add the flags parameter to the debug
message.

Signed-off-by: Christof Schmitt <christof.schmitt@us.ibm.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 4cd7e1d283f060e794023d5b0a48a7ec97d33820)

The last two patches address bug #9970 - Backport vfs_streams_xattr fixes to 4.0
and 4.1.

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Wed Jul  3 12:22:43 CEST 2013 on sn-devel-104
source3/modules/vfs_streams_xattr.c