mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-08 19:55:47 +00:00
2008-10-21 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerPolicy.c - (update_etc_hosts): don't leak errors, and ensure that g_file_set_contents() gets a valid error placeholder (rh #461933) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4201 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
0c8a2000cb
commit
1a411fae81
|
@ -1,3 +1,9 @@
|
|||
2008-10-21 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/NetworkManagerPolicy.c
|
||||
- (update_etc_hosts): don't leak errors, and ensure that
|
||||
g_file_set_contents() gets a valid error placeholder (rh #461933)
|
||||
|
||||
2008-10-21 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-manager.c
|
||||
|
|
|
@ -266,6 +266,8 @@ update_etc_hosts (const char *hostname)
|
|||
nm_warning ("%s: couldn't read " SYSCONFDIR "/hosts: (%d) %s",
|
||||
__func__, error ? error->code : 0,
|
||||
(error && error->message) ? error->message : "(unknown)");
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
} else {
|
||||
lines = g_strsplit_set (contents, "\n\r", 0);
|
||||
g_free (contents);
|
||||
|
@ -312,10 +314,13 @@ update_etc_hosts (const char *hostname)
|
|||
g_string_append (new_contents, "127.0.0.1\t" FALLBACK_HOSTNAME "\tlocalhost");
|
||||
}
|
||||
|
||||
error = NULL;
|
||||
if (!g_file_set_contents (SYSCONFDIR "/hosts", new_contents->str, -1, &error)) {
|
||||
nm_warning ("%s: couldn't update " SYSCONFDIR "/hosts: (%d) %s",
|
||||
__func__, error ? error->code : 0,
|
||||
(error && error->message) ? error->message : "(unknown)");
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
} else
|
||||
success = TRUE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user