Correctly exit sway on errors.

Calling `exit` in sway_terminate prevents sway from correctly shutting
down (freeing data, cleanly terminating the ipc server, etc.).

A better way is to exit straight away if the failure occurs before
`wlc_run` and use sway_abort as usual if it occur when wlc is running.
This commit is contained in:
Mikkel Oscar Lyderik 2016-02-26 09:08:05 +01:00
parent f62e05982f
commit 381df20e24

4
main.c
View File

@ -24,7 +24,7 @@ enum scaling_mode {
SCALING_MODE_TILE,
};
void sway_terminate(void) {
void sway_terminate(int exit_code) {
int i;
for (i = 0; i < surfaces->length; ++i) {
struct window *window = surfaces->items[i];
@ -32,7 +32,7 @@ void sway_terminate(void) {
}
list_free(surfaces);
registry_teardown(registry);
exit(EXIT_FAILURE);
exit(exit_code);
}
char *password;