mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 23:10:29 +01:00
ifcfg-rh: emit the right message when ignored connections are deleted
Previously the code would assume that if the ifcfg file had no backing connection that we should try to read it in regardless of what the inotify event was. But if the event was DELETED, there's no point in trying to read a deleted file in; it's gone. Don't print bogus warnings about failure to read the long-gone ifcfg file.
This commit is contained in:
parent
01ad64299a
commit
5dedf06fb9
1 changed files with 18 additions and 18 deletions
|
|
@ -164,7 +164,7 @@ read_one_connection (SCPluginIfcfg *plugin, const char *filename)
|
|||
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, " error: %s",
|
||||
(error && error->message) ? error->message : "(unknown)");
|
||||
}
|
||||
g_error_free (error);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
return connection;
|
||||
|
|
@ -334,25 +334,25 @@ dir_changed (GFileMonitor *monitor,
|
|||
g_free (path);
|
||||
|
||||
connection = g_hash_table_lookup (priv->connections, name);
|
||||
if (!connection) {
|
||||
do_new = TRUE;
|
||||
} else {
|
||||
switch (event_type) {
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "removed %s.", name);
|
||||
do_remove = TRUE;
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||
/* Update */
|
||||
switch (event_type) {
|
||||
case G_FILE_MONITOR_EVENT_DELETED:
|
||||
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "removed %s.", name);
|
||||
if (connection)
|
||||
handle_connection_remove_or_new (plugin, name, connection, TRUE, FALSE);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||
/* Update */
|
||||
if (!connection)
|
||||
do_new = TRUE;
|
||||
else
|
||||
connection_changed_handler (plugin, name, connection, &do_remove, &do_new);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handle_connection_remove_or_new (plugin, name, connection, do_remove, do_new);
|
||||
handle_connection_remove_or_new (plugin, name, connection, do_remove, do_new);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue