aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhugbubby <hugbubby@github.com>2019-03-01 12:14:14 -0600
committerDrew DeVault <sir@cmpwn.com>2019-03-04 12:50:47 -0500
commite0cdcad9a7b56ca6fed817b0429f393028df63b7 (patch)
tree6b122d51250f5b1688fcc135b5acf2d634aaa366
parent9593c72616a358188e08db2d3e6f8b74abd29b88 (diff)
downloadsway-e0cdcad9a7b56ca6fed817b0429f393028df63b7.zip
sway-e0cdcad9a7b56ca6fed817b0429f393028df63b7.tar.gz
sway-e0cdcad9a7b56ca6fed817b0429f393028df63b7.tar.bz2
Minor fix of code duplication.
Removes 3~ lines of code that didn't need to be restated.
-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;
}