mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-18 08:20:34 +01:00
ifcfg-rh: refactor nm_settings_plugin_add_connection() to return on error early
This commit is contained in:
parent
74eeb90d96
commit
304bf5563f
1 changed files with 9 additions and 5 deletions
|
|
@ -169,13 +169,17 @@ nm_settings_plugin_add_connection (NMSettingsPlugin *config,
|
|||
gboolean save_to_disk,
|
||||
GError **error)
|
||||
{
|
||||
NMSettingsPluginInterface *config_interface;
|
||||
|
||||
g_return_val_if_fail (config != NULL, NULL);
|
||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
||||
|
||||
if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->add_connection)
|
||||
return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->add_connection (config, connection, save_to_disk, error);
|
||||
config_interface = NM_SETTINGS_PLUGIN_GET_INTERFACE (config);
|
||||
if (!config_interface->add_connection) {
|
||||
g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_NOT_SUPPORTED,
|
||||
"Plugin does not support adding connections");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_NOT_SUPPORTED,
|
||||
"Plugin does not support adding connections");
|
||||
return NULL;
|
||||
return config_interface->add_connection (config, connection, save_to_disk, error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue