diff options
author | Connor E <38229097+c-edw@users.noreply.github.com> | 2019-02-05 14:37:22 +0000 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-02-11 10:22:53 -0500 |
commit | 2112f0aa2fcdf278dd3dccecc1a8261d3c97b44b (patch) | |
tree | 17e92b98f80976772f04e25c0b56d08fc9e1de15 /sway/main.c | |
parent | cmd_workspace_gaps: fix double free on bad amount (diff) | |
download | sway-2112f0aa2fcdf278dd3dccecc1a8261d3c97b44b.tar.gz sway-2112f0aa2fcdf278dd3dccecc1a8261d3c97b44b.tar.zst sway-2112f0aa2fcdf278dd3dccecc1a8261d3c97b44b.zip |
If validating the config, do it as early as possible.
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sway/main.c b/sway/main.c index a3198af1..b3ffdd83 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -312,6 +312,18 @@ int main(int argc, char **argv) { | |||
312 | wlr_log_init(WLR_ERROR, NULL); | 312 | wlr_log_init(WLR_ERROR, NULL); |
313 | } | 313 | } |
314 | 314 | ||
315 | log_kernel(); | ||
316 | log_distro(); | ||
317 | log_env(); | ||
318 | detect_proprietary(allow_unsupported_gpu); | ||
319 | detect_raspi(); | ||
320 | |||
321 | if (validate) { | ||
322 | bool valid = load_main_config(config_path, false, true); | ||
323 | free(config_path); | ||
324 | return valid ? 0 : 1; | ||
325 | } | ||
326 | |||
315 | if (optind < argc) { // Behave as IPC client | 327 | if (optind < argc) { // Behave as IPC client |
316 | if (optind != 1) { | 328 | if (optind != 1) { |
317 | sway_log(SWAY_ERROR, "Don't use options with the IPC client"); | 329 | sway_log(SWAY_ERROR, "Don't use options with the IPC client"); |
@@ -334,11 +346,6 @@ int main(int argc, char **argv) { | |||
334 | return 1; | 346 | return 1; |
335 | } | 347 | } |
336 | 348 | ||
337 | log_kernel(); | ||
338 | log_distro(); | ||
339 | detect_proprietary(allow_unsupported_gpu); | ||
340 | detect_raspi(); | ||
341 | |||
342 | if (!drop_permissions()) { | 349 | if (!drop_permissions()) { |
343 | server_fini(&server); | 350 | server_fini(&server); |
344 | exit(EXIT_FAILURE); | 351 | exit(EXIT_FAILURE); |
@@ -359,12 +366,6 @@ int main(int argc, char **argv) { | |||
359 | } | 366 | } |
360 | 367 | ||
361 | ipc_init(&server); | 368 | ipc_init(&server); |
362 | log_env(); | ||
363 | |||
364 | if (validate) { | ||
365 | bool valid = load_main_config(config_path, false, true); | ||
366 | return valid ? 0 : 1; | ||
367 | } | ||
368 | 369 | ||
369 | setenv("WAYLAND_DISPLAY", server.socket, true); | 370 | setenv("WAYLAND_DISPLAY", server.socket, true); |
370 | if (!load_main_config(config_path, false, false)) { | 371 | if (!load_main_config(config_path, false, false)) { |