From 5dedf06fb92a22f8f979e820370d606e9e0ae38c Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 9 Aug 2010 13:13:02 -0500 Subject: [PATCH] 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. --- system-settings/plugins/ifcfg-rh/plugin.c | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/system-settings/plugins/ifcfg-rh/plugin.c b/system-settings/plugins/ifcfg-rh/plugin.c index 8a831228c2..acde396ac7 100644 --- a/system-settings/plugins/ifcfg-rh/plugin.c +++ b/system-settings/plugins/ifcfg-rh/plugin.c @@ -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); }