Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[config] Ignore legacy mode=ask setting. JB#45869
For the purpose of preserving runtime modifications values in legacy
configuration files need to be given priority over new style static
configuration files. As a side effect this makes it impossible to
override default mode if it was done via defining mode=ask in the
legacy config file.

Ignore mode=ask if defined in a legacy config file.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed May 14, 2019
1 parent 9673330 commit a7b8df3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/usb_moded-config.c
Expand Up @@ -834,6 +834,23 @@ static bool config_load_legacy_config(GKeyFile *ini)
bool ack = false;
if( access(USB_MODED_STATIC_CONFIG_FILE, F_OK) != -1 )
ack = config_merge_from_file(ini, USB_MODED_STATIC_CONFIG_FILE);

/* A mode=ask setting in legacy config can be either
* something user has selected, or merely configured
* default. As the latter case interferes with evaluation
* of priority ordered static configuration files, ignore
* such settings.
*/
gchar *val = g_key_file_get_value(ini, MODE_SETTING_ENTRY,
MODE_SETTING_KEY, 0);
if( val ) {
if( !g_strcmp0(val, MODE_ASK) ) {
g_key_file_remove_key(ini, MODE_SETTING_ENTRY,
MODE_SETTING_KEY, 0);
}
g_free(val);
}

return ack;
}

Expand Down

0 comments on commit a7b8df3

Please sign in to comment.