diff options
-rw-r--r-- | sway/main.c | 9 |
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) { | |||
197 | static void drop_permissions(void) { | 197 | static 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 | ||