From: Maria Matejka Date: Thu, 29 Aug 2024 12:37:19 +0000 (+0200) Subject: Fixed a stupid bug in parse-and-exit mode X-Git-Tag: v2.16~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ba6e797ccd365f5c930a18953a08d3c5e315ff9;p=thirdparty%2Fbird.git Fixed a stupid bug in parse-and-exit mode Introduced in 08ff0af8986099e6fb1d8a94c7ce62c83e4df7f1, the additional CLI configuration wasn't properly initialized in the parse-and-exit mode due to an oversight that cli_init_unix() is not called in this mode. Thanks to Felix Friedlander for the bugreport. --- diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 880cc3c4a..b825a1f31 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -599,7 +599,6 @@ static void cli_init_unix(uid_t use_uid, gid_t use_gid) { ASSERT_DIE(main_control_socket_config == NULL); - cli_init(); main_control_socket_config = &initial_control_socket_config; main_control_socket_config->uid = use_uid; @@ -614,6 +613,9 @@ cli_init_unix(uid_t use_uid, gid_t use_gid) static void cli_preconfig(struct config *c) { + if (!main_control_socket_config) + return; + struct cli_config *ccf = mb_alloc(cli_pool, sizeof *ccf); memcpy(ccf, main_control_socket_config, sizeof *ccf); ccf->n = (struct cli_config_node) {}; @@ -1011,6 +1013,8 @@ main(int argc, char **argv) uid_t use_uid = get_uid(use_user); gid_t use_gid = get_gid(use_group); + cli_init(); + if (!parse_and_exit) { test_old_bird(path_control_socket);