Security about the user
This commit is contained in:
parent
a0a74729fc
commit
ef0adeb721
6
main.cpp
6
main.cpp
@ -11,6 +11,12 @@ int main(int argc, char *argv[]) {
|
||||
auto logger = spdlog::stdout_color_st("single_log");
|
||||
spdlog::set_default_logger(logger);
|
||||
|
||||
// If the user si root, stop the program
|
||||
if (getuid() == 0) {
|
||||
spdlog::error("The user is root. Stopping the program.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
po::options_description description{ "Allowed options" };
|
||||
description.add_options()("help", "produce help message")("config", po::value<std::string>(), "path to the config file");
|
||||
po::variables_map vm;
|
||||
|
Loading…
Reference in New Issue
Block a user