mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 00:00:30 +01:00
core: use define for atomic-section-prefix setting for NMConfig
main() should pass the same atomic-section-prefix setting to it's NMConfig instances. Currently both are NULL, but make it a define to make this explicit. Also, make static array @default_values const and sanitize value when setting PROP_ATOMIC_SECTION_PREFIXES property.
This commit is contained in:
parent
a8f0d88596
commit
9e5319dbc0
3 changed files with 10 additions and 4 deletions
|
|
@ -59,6 +59,8 @@
|
|||
#define NM_DEFAULT_PID_FILE NMRUNDIR "/NetworkManager.pid"
|
||||
#define NM_DEFAULT_SYSTEM_STATE_FILE NMSTATEDIR "/NetworkManager.state"
|
||||
|
||||
#define CONFIG_ATOMIC_SECTION_PREFIXES ((char **) NULL)
|
||||
|
||||
static GMainLoop *main_loop = NULL;
|
||||
static gboolean configure_and_quit = FALSE;
|
||||
|
||||
|
|
@ -167,7 +169,7 @@ print_config (NMConfigCmdLineOptions *config_cli)
|
|||
|
||||
nm_logging_setup ("OFF", "ALL", NULL, NULL);
|
||||
|
||||
config = nm_config_new (config_cli, NULL, &error);
|
||||
config = nm_config_new (config_cli, CONFIG_ATOMIC_SECTION_PREFIXES, &error);
|
||||
if (config == NULL) {
|
||||
fprintf (stderr, _("Failed to read configuration: %s\n"), error->message);
|
||||
return 7;
|
||||
|
|
@ -300,7 +302,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Read the config file and CLI overrides */
|
||||
config = nm_config_setup (config_cli, NULL, &error);
|
||||
config = nm_config_setup (config_cli, CONFIG_ATOMIC_SECTION_PREFIXES, &error);
|
||||
nm_config_cmd_line_options_free (config_cli);
|
||||
config_cli = NULL;
|
||||
if (config == NULL) {
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ _nm_config_data_log_sort (const char **pa, const char **pb, gpointer dummy)
|
|||
return g_strcmp0 (a, b);
|
||||
}
|
||||
|
||||
static struct {
|
||||
static const struct {
|
||||
const char *group;
|
||||
const char *key;
|
||||
const char *value;
|
||||
|
|
|
|||
|
|
@ -2230,6 +2230,7 @@ set_property (GObject *object, guint prop_id,
|
|||
NMConfig *self = NM_CONFIG (object);
|
||||
NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (self);
|
||||
NMConfigCmdLineOptions *cli;
|
||||
char **strv;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CMD_LINE_OPTIONS:
|
||||
|
|
@ -2242,7 +2243,10 @@ set_property (GObject *object, guint prop_id,
|
|||
break;
|
||||
case PROP_ATOMIC_SECTION_PREFIXES:
|
||||
/* construct-only */
|
||||
priv->atomic_section_prefixes = g_strdupv (g_value_get_boxed (value));
|
||||
strv = g_value_get_boxed (value);
|
||||
if (strv && !strv[0])
|
||||
strv = NULL;
|
||||
priv->atomic_section_prefixes = g_strdupv (strv);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue