mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
a5d80f7e3b
Following the discussion in #334, shutdown must also have root-only run permissions.
20 lines
452 B
C++
20 lines
452 B
C++
#include <LibCore/CArgsParser.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
CArgsParser args_parser("shutdown");
|
|
args_parser.add_arg("n", "shut down now");
|
|
CArgsParserResult args = args_parser.parse(argc, argv);
|
|
|
|
if (args.is_present("n")) {
|
|
if (halt() < 0) {
|
|
perror("shutdown");
|
|
return 1;
|
|
}
|
|
} else {
|
|
args_parser.print_usage();
|
|
return 0;
|
|
}
|
|
}
|