[PATCH] vfs_streams_xattr: Avoid EBADF in error path

Jeremy Allison jra at samba.org
Tue Jun 11 18:04:19 MDT 2013


On Tue, Jun 11, 2013 at 04:48:39PM -0700, Christof Schmitt wrote:
> 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

Looks good to me - you can add : Reviewed-by: Jeremy Allison <jra at samba.org>.
Can we get another Team reviewer ?

Thanks,

Jeremy.


More information about the samba-technical mailing list