aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhugbubby <hugbubby@github.com>2019-03-01 12:14:14 -0600
committeremersion <contact@emersion.fr>2019-03-02 00:49:02 +0100
commit37f0e1f1a2cc8e072c8e01e0769c62c536b8295b (patch)
tree6d52e897dd35a6094a71144d6ed5288d9418bb4d
parent77b16a5124efb8ede9c4219ddea7832503ebfddf (diff)
downloadsway-37f0e1f1a2cc8e072c8e01e0769c62c536b8295b.zip
sway-37f0e1f1a2cc8e072c8e01e0769c62c536b8295b.tar.gz
sway-37f0e1f1a2cc8e072c8e01e0769c62c536b8295b.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;
}