From edbf7f430cff0755fa69a2e3dd7eb0489fa22c76 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 21 Mar 2019 22:37:35 +0000 Subject: [PATCH] Initialize tls log structure in main Fix error reporting when failed to open X display. Signed-off-by: Yuxuan Shui --- src/compton.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compton.c b/src/compton.c index 16a7966..2dd2fe0 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1723,7 +1723,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy, #endif }; - log_init_tls(); auto stderr_logger = stderr_logger_new(); if (stderr_logger) { // stderr logger might fail to create if we are already @@ -2315,6 +2314,7 @@ int main(int argc, char **argv) { // Set locale so window names with special characters are interpreted // correctly setlocale(LC_ALL, ""); + log_init_tls(); int exit_code; char *config_file = NULL; @@ -2357,7 +2357,7 @@ int main(int argc, char **argv) { bool quit = false; Display *dpy = XOpenDisplay(NULL); if (!dpy) { - log_fatal("Can't open display."); + fprintf(stderr, "Can't open display."); return 1; } XSetEventQueueOwner(dpy, XCBOwnsEventQueue);