1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

pid1: fold load_configuration() into main()

That's reduce the number of functions dealing with configuration
parsing/loading and should make the code simpler especially since this function
was used only once.

No functional change.
This commit is contained in:
Franck Bui 2020-04-27 08:36:47 +02:00
parent 986935cf6a
commit ffe5c01eaa

View File

@ -2257,29 +2257,6 @@ static int parse_configuration(const struct rlimit *saved_rlimit_nofile,
return 0;
}
static int load_configuration(
int argc,
char **argv,
const struct rlimit *saved_rlimit_nofile,
const struct rlimit *saved_rlimit_memlock,
const char **ret_error_message) {
int r;
assert(saved_rlimit_nofile);
assert(saved_rlimit_memlock);
assert(ret_error_message);
(void) parse_configuration(saved_rlimit_nofile, saved_rlimit_memlock);
r = parse_argv(argc, argv);
if (r < 0) {
*ret_error_message = "Failed to parse commandline arguments";
return r;
}
return 0;
}
static int safety_checks(void) {
if (getpid_cached() == 1 &&
@ -2618,9 +2595,13 @@ int main(int argc, char *argv[]) {
(void) reset_all_signal_handlers();
(void) ignore_signals(SIGNALS_IGNORE, -1);
r = load_configuration(argc, argv, &saved_rlimit_nofile, &saved_rlimit_memlock, &error_message);
if (r < 0)
(void) parse_configuration(&saved_rlimit_nofile, &saved_rlimit_memlock);
r = parse_argv(argc, argv);
if (r < 0) {
error_message = "Failed to parse commandline arguments";
goto finish;
}
r = safety_checks();
if (r < 0)