Skip to content

Commit e86dd1c

Browse files
tcl3awesomekling
authored andcommitted
usermod: Return error if -L and -U options are used simultaneously
1 parent 089ff7b commit e86dd1c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Userland/Utilities/usermod.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2021, Brandon Pruitt <brapru@pm.me>
3+
* Copyright (c) 2023, Tim Ledbetter <timledbetter@gmail.com>
34
*
45
* SPDX-License-Identifier: BSD-2-Clause
56
*/
@@ -50,6 +51,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
5051

5152
args_parser.parse(arguments);
5253

54+
if (lock && unlock) {
55+
warnln("The -L and -U options are mutually exclusive");
56+
args_parser.print_usage(stderr, arguments.strings[0]);
57+
return 1;
58+
}
59+
5360
auto account_or_error = Core::Account::from_name(username);
5461

5562
if (account_or_error.is_error()) {

0 commit comments

Comments
 (0)