Since wayland requires XDG_RUNTIME_DIR--- a/sway/main.c
+++ b/sway/main.c
@@ -112,7 +112,8 @@
 }
 
 static bool detect_suid(void) {
-	if (geteuid() != 0 && getegid() != 0) {
+	if (geteuid() == 0 && getegid() == 0) {
+		sway_log(SWAY_INFO, "Running sway as root user");
 		return false;
 	}
 
@@ -266,11 +267,6 @@
 		}
 	}
 
-	// SUID operation is deprecated, so block it for now.
-	if (detect_suid()) {
-		exit(EXIT_FAILURE);
-	}
-
 	// Since wayland requires XDG_RUNTIME_DIR to be set, abort with just the
 	// clear error message (when not running as an IPC client).
 	if (!getenv("XDG_RUNTIME_DIR") && optind == argc) {
@@ -320,6 +316,11 @@
 		return 0;
 	}
 
+	// SUID operation is deprecated, so block it for now.
+	if (detect_suid()) {
+		exit(EXIT_FAILURE);
+	}
+
 	increase_nofile_limit();
 
 	// handle SIGTERM signals

