aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-10-29 23:52:03 +0100
committerLibravatar emersion <contact@emersion.fr>2018-11-01 18:49:42 +0100
commit9dae68eba51a7b9289d9a64ae8880539ffeca2c0 (patch)
treef8209425c3a0655423f91ffd7247cfa3cb58b323 /sway/main.c
parentFix #2992 (diff)
downloadsway-9dae68eba51a7b9289d9a64ae8880539ffeca2c0.tar.gz
sway-9dae68eba51a7b9289d9a64ae8880539ffeca2c0.tar.zst
sway-9dae68eba51a7b9289d9a64ae8880539ffeca2c0.zip
Make it clear that being able to restore root is a failure
Diffstat (limited to 'sway/main.c')
-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) {
197static void drop_permissions(void) { 197static void drop_permissions(void) {
198 if (getuid() != geteuid() || getgid() != getegid()) { 198 if (getuid() != geteuid() || getgid() != getegid()) {
199 if (setgid(getgid()) != 0) { 199 if (setgid(getgid()) != 0) {
200 wlr_log(WLR_ERROR, "Unable to drop root"); 200 wlr_log(WLR_ERROR, "Unable to drop root, refusing to start");
201 exit(EXIT_FAILURE); 201 exit(EXIT_FAILURE);
202 } 202 }
203 if (setuid(getuid()) != 0) { 203 if (setuid(getuid()) != 0) {
204 wlr_log(WLR_ERROR, "Unable to drop root"); 204 wlr_log(WLR_ERROR, "Unable to drop root, refusing to start");
205 exit(EXIT_FAILURE); 205 exit(EXIT_FAILURE);
206 } 206 }
207 } 207 }
208 if (setuid(0) != -1) { 208 if (setuid(0) != -1) {
209 wlr_log(WLR_ERROR, "Root privileges can be restored."); 209 wlr_log(WLR_ERROR, "Unable to drop root (we shouldn't be able to "
210 exit(EXIT_FAILURE); 210 "restore it after setuid), refusing to start");
211 return false;
211 } 212 }
212} 213}
213 214