2005-12-13 Robert Love <rml@novell.com>

* src/named-manager/nm-named-manager.c: Revert earlier commit.  Instead, fail silently if config is NULL
	  by not asserting and not returning FALSE.  Also, make sure we always fclose() the file.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1180 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love
2005-12-13 21:45:52 +00:00
committed by Robert Love
parent 4be49b9902
commit bfe8ef82a8
2 changed files with 14 additions and 6 deletions

View File

@@ -354,11 +354,13 @@ rewrite_resolv_conf (NMNamedManager *mgr, NMIP4Config *config, GError **error)
char * searches = NULL;
FILE * f;
g_return_val_if_fail (config != NULL, FALSE);
/* If no config, we don't have anything to update, so exit silently */
if (!config)
return TRUE;
if ((f = fopen (tmp_resolv_conf, "w")) == NULL)
goto lose;
if (fprintf (f, "%s","# generated by NetworkManager, do not edit!\n\n") < 0)
goto lose;
@@ -390,8 +392,9 @@ rewrite_resolv_conf (NMNamedManager *mgr, NMIP4Config *config, GError **error)
nm_system_update_dns ();
return TRUE;
lose:
lose:
g_free (searches);
fclose (f);
g_set_error (error,
NM_NAMED_MANAGER_ERROR,
NM_NAMED_MANAGER_ERROR_SYSTEM,
@@ -706,6 +709,9 @@ nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config)
if (mgr->priv->use_named)
remove_ip4_config_from_named (mgr, config);
mgr->priv->configs = g_slist_remove (mgr->priv->configs, config);
nm_ip4_config_unref (config);
/* Clear out and reload configs since we may need a new
* default zone if the one we are removing was the old
* default zone.
@@ -723,9 +729,6 @@ nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config)
g_error_free (error);
}
mgr->priv->configs = g_slist_remove (mgr->priv->configs, config);
nm_ip4_config_unref (config);
return TRUE;
}