X Tutup
Skip to content

Commit ffe5c01

Browse files
committed
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.
1 parent 986935c commit ffe5c01

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

src/core/main.c

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,29 +2257,6 @@ static int parse_configuration(const struct rlimit *saved_rlimit_nofile,
22572257
return 0;
22582258
}
22592259

2260-
static int load_configuration(
2261-
int argc,
2262-
char **argv,
2263-
const struct rlimit *saved_rlimit_nofile,
2264-
const struct rlimit *saved_rlimit_memlock,
2265-
const char **ret_error_message) {
2266-
int r;
2267-
2268-
assert(saved_rlimit_nofile);
2269-
assert(saved_rlimit_memlock);
2270-
assert(ret_error_message);
2271-
2272-
(void) parse_configuration(saved_rlimit_nofile, saved_rlimit_memlock);
2273-
2274-
r = parse_argv(argc, argv);
2275-
if (r < 0) {
2276-
*ret_error_message = "Failed to parse commandline arguments";
2277-
return r;
2278-
}
2279-
2280-
return 0;
2281-
}
2282-
22832260
static int safety_checks(void) {
22842261

22852262
if (getpid_cached() == 1 &&
@@ -2618,9 +2595,13 @@ int main(int argc, char *argv[]) {
26182595
(void) reset_all_signal_handlers();
26192596
(void) ignore_signals(SIGNALS_IGNORE, -1);
26202597

2621-
r = load_configuration(argc, argv, &saved_rlimit_nofile, &saved_rlimit_memlock, &error_message);
2622-
if (r < 0)
2598+
(void) parse_configuration(&saved_rlimit_nofile, &saved_rlimit_memlock);
2599+
2600+
r = parse_argv(argc, argv);
2601+
if (r < 0) {
2602+
error_message = "Failed to parse commandline arguments";
26232603
goto finish;
2604+
}
26242605

26252606
r = safety_checks();
26262607
if (r < 0)

0 commit comments

Comments
 (0)
X Tutup