mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
useradd: Simplify uid validation
This commit is contained in:
parent
8955560801
commit
08cb49c2bd
Notes:
sideshowbarker
2024-07-16 22:22:13 +09:00
Author: https://github.com/tcl3
Commit: 08cb49c2bd
Pull-request: https://github.com/SerenityOS/serenity/pull/20794
1 changed files with 1 additions and 6 deletions
|
@ -55,7 +55,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(Core::System::pledge("stdio wpath rpath cpath chown"));
|
TRY(Core::System::pledge("stdio wpath rpath cpath chown"));
|
||||||
|
|
||||||
StringView home_path;
|
StringView home_path;
|
||||||
int uid = 0;
|
uid_t uid = 0;
|
||||||
gid_t gid = USERS_GID;
|
gid_t gid = USERS_GID;
|
||||||
bool create_home_dir = false;
|
bool create_home_dir = false;
|
||||||
DeprecatedString password = "";
|
DeprecatedString password = "";
|
||||||
|
@ -109,11 +109,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uid < 0) {
|
|
||||||
warnln("invalid uid {}!", uid);
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// First, let's sort out the uid for the user
|
// First, let's sort out the uid for the user
|
||||||
if (uid > 0) {
|
if (uid > 0) {
|
||||||
auto pwd = TRY(Core::System::getpwuid(static_cast<uid_t>(uid)));
|
auto pwd = TRY(Core::System::getpwuid(static_cast<uid_t>(uid)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue