Initialize tls log structure in main

Fix error reporting when failed to open X display.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-21 22:37:35 +00:00
parent e267b9178e
commit edbf7f430c
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 2 additions and 2 deletions

View File

@ -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);