move perrors earlier

Should come right after the erroring call so nothing else has a chance
to overwrite errno
main
Devin J. Pohly 2020-06-07 11:42:43 -05:00
parent da5b4d965d
commit f19d00b94a
1 changed files with 2 additions and 2 deletions

4
dwl.c
View File

@ -1073,17 +1073,17 @@ run(char *startup_cmd)
/* Add a Unix socket to the Wayland display. */ /* Add a Unix socket to the Wayland display. */
const char *socket = wl_display_add_socket_auto(dpy); const char *socket = wl_display_add_socket_auto(dpy);
if (!socket) { if (!socket) {
perror("startup: display_add_socket_auto");
wlr_backend_destroy(backend); wlr_backend_destroy(backend);
perror("startup: socket");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Start the backend. This will enumerate outputs and inputs, become the DRM /* Start the backend. This will enumerate outputs and inputs, become the DRM
* master, etc */ * master, etc */
if (!wlr_backend_start(backend)) { if (!wlr_backend_start(backend)) {
perror("startup: backend_start");
wlr_backend_destroy(backend); wlr_backend_destroy(backend);
wl_display_destroy(dpy); wl_display_destroy(dpy);
perror("startup: backend_start");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }