From 0f4c227c1f7dfa550006551ff59406420dc98df6 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 5 Nov 2008 17:43:45 +0000 Subject: [PATCH] 2008-11-05 Dan Williams * src/NetworkManagerPolicy.c - (update_etc_hosts): only add newline if not the last line of the file (Jonathan Miner) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4268 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 6 ++++++ src/NetworkManagerPolicy.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0c55b7e3f2..e7ddf10c17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-05 Dan Williams + + * src/NetworkManagerPolicy.c + - (update_etc_hosts): only add newline if not the last line of the file + (Jonathan Miner) + 2008-11-05 Dan Williams * src/dhcp-manager/nm-dhcp-dhclient.c diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index 45403a2a63..de85d4caff 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -306,7 +306,9 @@ update_etc_hosts (const char *hostname) if (add_line) { g_string_append (new_contents, *line); - g_string_append_c (new_contents, '\n'); + /* Only append the new line if this isn't the last line in the file */ + if (*(line+1)) + g_string_append_c (new_contents, '\n'); } }