From 26396bf156cfa00ecd655ec6a5f2f46626d674c0 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Tue, 2 Feb 2021 12:15:10 +0100 Subject: Add newline when printing auth/connection failure string to stderr The reason strings returned by the server don't all include a newline, so make sure we add one to avoid confusing clients. Xlib used to do this before it delegated that work to libxcb. Fixes #34 Signed-off-by: Julien Cristau --- src/xcb_conn.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xcb_conn.c b/src/xcb_conn.c index 1d2e62f..3084c18 100644 --- a/src/xcb_conn.c +++ b/src/xcb_conn.c @@ -170,6 +170,8 @@ static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info) static int read_setup(xcb_connection_t *c) { + const char newline = '\n'; + /* Read the server response */ c->setup = malloc(sizeof(xcb_setup_generic_t)); if(!c->setup) @@ -195,6 +197,7 @@ static int read_setup(xcb_connection_t *c) { xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup; write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup)); + write(STDERR_FILENO, &newline, 1); return 0; } @@ -202,6 +205,7 @@ static int read_setup(xcb_connection_t *c) { xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup; write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup)); + write(STDERR_FILENO, &newline, 1); return 0; } } -- cgit v1.2.3