aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-10-29 23:52:03 +0100
committeremersion <contact@emersion.fr>2018-11-01 18:49:42 +0100
commit9dae68eba51a7b9289d9a64ae8880539ffeca2c0 (patch)
treef8209425c3a0655423f91ffd7247cfa3cb58b323 /sway
parentcd0bae80b6f1cc27ffff47618b4332449468134c (diff)
downloadsway-9dae68eba51a7b9289d9a64ae8880539ffeca2c0.tar.xz
Make it clear that being able to restore root is a failure
Diffstat (limited to 'sway')
-rw-r--r--sway/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sway/main.c b/sway/main.c
index cc5f7187..a810bb55 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -197,17 +197,18 @@ static void log_kernel(void) {
static void drop_permissions(void) {
if (getuid() != geteuid() || getgid() != getegid()) {
if (setgid(getgid()) != 0) {
- wlr_log(WLR_ERROR, "Unable to drop root");
+ wlr_log(WLR_ERROR, "Unable to drop root, refusing to start");
exit(EXIT_FAILURE);
}
if (setuid(getuid()) != 0) {
- wlr_log(WLR_ERROR, "Unable to drop root");
+ wlr_log(WLR_ERROR, "Unable to drop root, refusing to start");
exit(EXIT_FAILURE);
}
}
if (setuid(0) != -1) {
- wlr_log(WLR_ERROR, "Root privileges can be restored.");
- exit(EXIT_FAILURE);
+ wlr_log(WLR_ERROR, "Unable to drop root (we shouldn't be able to "
+ "restore it after setuid), refusing to start");
+ return false;
}
}