[Xcb] [PATCH:app/xlsclients] Fix check for xcb_connect failure

Alan Coopersmith Alan.Coopersmith at Sun.COM
Tue Oct 27 12:51:47 PDT 2009


I got no feedback, but it worked for me, so I went ahead and pushed.
I couldn't see an example of this in the tutorial or documentation,
perhaps that should be added?

	-alan

Alan Coopersmith wrote:
> Prevents core dump when display can't be opened
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
> ---
>  xlsclients.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xlsclients.c b/xlsclients.c
> index 049bc4c..00657aa 100644
> --- a/xlsclients.c
> +++ b/xlsclients.c
> @@ -178,7 +178,7 @@ main(int argc, char *argv[])
>      }
>  
>      dpy = xcb_connect(displayname, &screen_number);
> -    if (!dpy) {
> +    if (xcb_connection_has_error(dpy)) {
>  	char *name = displayname;
>  	if (!name)
>  	    name = getenv("DISPLAY");

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering



More information about the Xcb mailing list