From 08cb49c2bdc695ab7adb610fb1d7bd00ac2c42ab Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Mon, 26 Jun 2023 20:48:50 +0100 Subject: [PATCH] useradd: Simplify uid validation --- Userland/Utilities/useradd.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Userland/Utilities/useradd.cpp b/Userland/Utilities/useradd.cpp index 51fc5201e3..f12be48581 100644 --- a/Userland/Utilities/useradd.cpp +++ b/Userland/Utilities/useradd.cpp @@ -55,7 +55,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio wpath rpath cpath chown")); StringView home_path; - int uid = 0; + uid_t uid = 0; gid_t gid = USERS_GID; bool create_home_dir = false; DeprecatedString password = ""; @@ -109,11 +109,6 @@ ErrorOr serenity_main(Main::Arguments arguments) return 1; } - if (uid < 0) { - warnln("invalid uid {}!", uid); - return 3; - } - // First, let's sort out the uid for the user if (uid > 0) { auto pwd = TRY(Core::System::getpwuid(static_cast(uid)));