aboutsummaryrefslogtreecommitdiff
path: root/sway/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/sway/main.c b/sway/main.c
index 6754190..22b7281 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -186,11 +186,7 @@ static void log_kernel(void) {
static bool drop_permissions(void) {
if (getuid() != geteuid() || getgid() != getegid()) {
- if (setgid(getgid()) != 0) {
- sway_log(SWAY_ERROR, "Unable to drop root, refusing to start");
- return false;
- }
- if (setuid(getuid()) != 0) {
+ if (setuid(getuid()) != 0 || setgid(getgid()) != 0) {
sway_log(SWAY_ERROR, "Unable to drop root, refusing to start");
return false;
}