[PATCH] vfs_streams_xattr: Avoid EBADF in error path

Christof Schmitt christof.schmitt at us.ibm.com
Tue Jun 11 17:48:39 MDT 2013


Initialize the file descriptor in the files_struct before trying to
close it. Otherwise, if one of the SETXATTR calls had failed, the
close() call will return EBADF.

Signed-off-by: Christof Schmitt <christof.schmitt at us.ibm.com>
---
 source3/modules/vfs_streams_xattr.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index de67197..82e2dd8 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -527,6 +527,7 @@ static int streams_xattr_open(vfs_handle_struct *handle,
 		 * BUGBUGBUG -- we would need to call fd_close_posix here, but
 		 * we don't have a full fsp yet
 		 */
+		fsp->fh->fd = hostfd;
 		SMB_VFS_CLOSE(fsp);
 	}
 
-- 
1.7.1



More information about the samba-technical mailing list