mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-11 04:50:33 +01:00
ifcfg-rh: don't shortcut writing if the connection stays the same
Some keys, such as MASTER may still be different as they may depend on other connections. svWriteFile() checks if the resulting file is different already anyway.
This commit is contained in:
parent
61722fdeb1
commit
54086127ef
1 changed files with 1 additions and 24 deletions
|
|
@ -336,35 +336,12 @@ commit_changes (NMSettingsConnection *connection,
|
|||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
NMConnection *reread;
|
||||
gboolean same = FALSE, success = FALSE;
|
||||
gboolean success = FALSE;
|
||||
char *ifcfg_path = NULL;
|
||||
const char *filename;
|
||||
|
||||
/* To ensure we don't rewrite files that are only changed from other
|
||||
* processes on-disk, read the existing connection back in and only rewrite
|
||||
* it if it's really changed.
|
||||
*/
|
||||
filename = nm_settings_connection_get_filename (connection);
|
||||
if (filename) {
|
||||
gs_free char *unhandled = NULL;
|
||||
|
||||
reread = connection_from_file (filename, &unhandled, NULL, NULL);
|
||||
if (reread) {
|
||||
same = nm_connection_compare (NM_CONNECTION (connection),
|
||||
reread,
|
||||
NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS |
|
||||
NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS);
|
||||
g_object_unref (reread);
|
||||
|
||||
/* Don't bother writing anything out if in-memory and on-disk data are the same */
|
||||
if (same) {
|
||||
/* But chain up to parent to handle success - emits updated signal */
|
||||
NM_SETTINGS_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->commit_changes (connection, commit_reason, callback, user_data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
success = writer_update_connection (NM_CONNECTION (connection),
|
||||
IFCFG_DIR,
|
||||
filename,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue