[PATCH] Fix possible close of invalid fd if call to socket() returns -1.

Jeremy Allison jra at samba.org
Thu Feb 21 01:59:14 GMT 2008


On Mon, Feb 18, 2008 at 10:43:46AM +1100, Tim Potter wrote:
> ---
>  source/lib/util_sock.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
> index 71d48d6..e040f46 100644
> --- a/source/lib/util_sock.c
> +++ b/source/lib/util_sock.c
> @@ -1933,7 +1933,8 @@ int create_pipe_sock(const char *socket_dir,
>  
>  out_close:
>  	SAFE_FREE(path);
> -	close(sock);
> +	if (sock != -1)
> +		close(sock);
>  
>  out_umask:
>  	umask(old_umask);
> -- 
> 1.5.2.5

Pushed ! Thanks


More information about the samba-technical mailing list