commit 9dae68eba51a7b9289d9a64ae8880539ffeca2c0
parent cd0bae80b6f1cc27ffff47618b4332449468134c
Author: emersion <contact@emersion.fr>
Date: Mon, 29 Oct 2018 23:52:03 +0100
Make it clear that being able to restore root is a failure
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git 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;
}
}