From ea14dab7d738a0aa33b2f975b8bee03e37972493 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 30 Jan 2024 20:26:54 +0100 Subject: [PATCH] wind: Stop using magic numbers for user and group IDs --- wind/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wind/main.cpp b/wind/main.cpp index 78e3dfdf..01309cf7 100644 --- a/wind/main.cpp +++ b/wind/main.cpp @@ -22,6 +22,9 @@ #include #include +static constexpr uid_t WIND_USER_ID = 2; +static constexpr gid_t WIND_GROUP_ID = 2; + static void debug(const Vector>& clients) { os::println("--- wind: DEBUG OUTPUT ---"); @@ -121,8 +124,8 @@ Result luna_main(int argc, char** argv) close(fd); } - setegid(2); - seteuid(2); + setegid(WIND_GROUP_ID); + seteuid(WIND_USER_ID); if (setsid() < 0) perror("setsid"); @@ -157,8 +160,8 @@ Result luna_main(int argc, char** argv) umask(0002); - setuid(2); - setgid(2); + setgid(WIND_GROUP_ID); + setuid(WIND_USER_ID); ui::Color background = ui::Color::from_rgb(0x10, 0x10, 0x10);