aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-28 19:52:28 +0100
committerS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-28 20:35:57 +0100
commit20cb390323b19dc0c767ba63925def7f51c31044 (patch)
tree38969a7241aabcd2750117929ace19d2f3d5b1c0 /sway
parent1661edee2808f5d293ce89bf46bd87faff25d654 (diff)
sway/main: Move wlc init to after args are handled.
First of all because it's not needed that early, and second of all because there's a bug where calling `sway --get-socketpath` via `popen` causes the child sway process to spin/hang instead of returning EOF. (Specifically `(unset SWAYSOCK; swaymsg)` hangs.) This patch fixes that. (Also note that this patch moves the "detailed review" comment, so I guess this patch requires extra detailed review?)
Diffstat (limited to 'sway')
-rw-r--r--sway/main.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/sway/main.c b/sway/main.c
index 19648782..dd609214 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -64,21 +64,7 @@ int main(int argc, char **argv) {
{0, 0, 0, 0}
};
- setenv("WLC_DIM", "0", 0);
-
- wlc_log_set_handler(wlc_log_handler);
-
- detect_nvidia();
-
- /* Changing code earlier than this point requires detailed review */
- if (!wlc_init(&interface, argc, argv)) {
- return 1;
- }
-
- register_extensions();
-
char *config_path = NULL;
-
int c;
while (1) {
int option_index = 0;
@@ -121,6 +107,18 @@ int main(int argc, char **argv) {
}
}
+ setenv("WLC_DIM", "0", 0);
+ wlc_log_set_handler(wlc_log_handler);
+ detect_nvidia();
+
+ /* Changing code earlier than this point requires detailed review */
+ /* (That code runs as root on systems without logind, and wlc_init drops to
+ * another user.) */
+ if (!wlc_init(&interface, argc, argv)) {
+ return 1;
+ }
+ register_extensions();
+
if (debug) {
init_log(L_DEBUG);
} else if (verbose || validate) {