[PATCH] vfs_streams_xattr: Avoid EBADF in error path

Richard Sharpe realrichardsharpe at gmail.com
Tue Jun 11 18:20:16 MDT 2013


On Tue, Jun 11, 2013 at 4:48 PM, Christof Schmitt
<christof.schmitt at us.ibm.com> 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
>

Add: Reviewed-by: Richard Sharpe <rsharpe at samba.org>

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list