diff options
author | Julien Cristau <jcristau@debian.org> | 2021-02-02 12:15:10 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2021-09-30 17:18:18 +0000 |
commit | 26396bf156cfa00ecd655ec6a5f2f46626d674c0 (patch) | |
tree | 2e27dc1d057c4a3ed76c7c2f92f00d1048f1058b /src | |
parent | a503167f751ba77e6819df568b7f5042d2baa9c9 (diff) |
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 <jcristau@debian.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/xcb_conn.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; } } |