diff options
| author | Michael Biebl <biebl@debian.org> | 2013-02-03 14:49:22 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2013-02-03 14:49:22 +0100 |
| commit | 9c202e3e860b3be9e1f8882630b69affbb130102 (patch) | |
| tree | 8202bf39f2129486971fa7d5ae0dee61a561aa53 /src/settings/plugins/ifnet/net_parser.c | |
| parent | 36cb2f364a821e1be50b23e03a18891ec55adb06 (diff) | |
Imported Upstream version 0.9.7.995 upstream/0.9.7.995
Diffstat (limited to 'src/settings/plugins/ifnet/net_parser.c')
| -rw-r--r-- | src/settings/plugins/ifnet/net_parser.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c index 2562e613..f37366af 100644 --- a/src/settings/plugins/ifnet/net_parser.c +++ b/src/settings/plugins/ifnet/net_parser.c @@ -590,7 +590,7 @@ done: } gboolean -ifnet_flush_to_file (const char *config_file) +ifnet_flush_to_file (const char *config_file, gchar **out_backup) { GIOChannel *channel; GError **error = NULL; @@ -600,18 +600,20 @@ ifnet_flush_to_file (const char *config_file) gchar *out_line = NULL; gsize bytes_written; gboolean result = FALSE; + gchar *backup; if (!net_parser_data_changed) return TRUE; if (!conn_table || !global_settings_table) return FALSE; - backup_file (config_file); + backup = backup_file (config_file); channel = g_io_channel_new_file (config_file, "w", NULL); if (!channel) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Can't open file %s for writing", config_file); + g_free (backup); return FALSE; } g_hash_table_iter_init (&iter, global_settings_table); @@ -714,7 +716,13 @@ ifnet_flush_to_file (const char *config_file) } result = TRUE; net_parser_data_changed = FALSE; + done: + if (result && out_backup) + *out_backup = backup; + else + g_free (backup); + g_io_channel_shutdown (channel, FALSE, NULL); g_io_channel_unref (channel); return result; |