From e0cdcad9a7b56ca6fed817b0429f393028df63b7 Mon Sep 17 00:00:00 2001 From: hugbubby Date: Fri, 1 Mar 2019 12:14:14 -0600 Subject: Minor fix of code duplication. Removes 3~ lines of code that didn't need to be restated. --- sway/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sway/main.c b/sway/main.c index 6754190f..22b72813 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; } -- cgit v1.2.3