RE: blank lines added to /etc/hosts [PATCH]
On Tue, 2008-11-04 at 17:04 -0500, Miner, Jonathan W (US SSA) wrote: > I think this will fix my issue... only append the newline if we're not > parsing the last line of the file. > > --- src/NetworkManagerPolicy.c.orig 2008-11-03 09:33:08.0 -0500 > +++ src/NetworkManagerPolicy.c2008-11-04 17:02:39.0 -0500 > @@ -306,7 +306,8 @@ > > if (add_line) { > g_string_append (new_contents, *line); > - g_string_append_c (new_contents, '\n'); > +if (*(line+1)) /* if not the last line */ > + g_string_append_c (new_contents, '\n'); > } > } Committed, thanks! dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
RE: blank lines added to /etc/hosts [PATCH]
I think this will fix my issue... only append the newline if we're not parsing the last line of the file. --- src/NetworkManagerPolicy.c.orig 2008-11-03 09:33:08.0 -0500 +++ src/NetworkManagerPolicy.c 2008-11-04 17:02:39.0 -0500 @@ -306,7 +306,8 @@ if (add_line) { g_string_append (new_contents, *line); - g_string_append_c (new_contents, '\n'); +if (*(line+1)) /* if not the last line */ + g_string_append_c (new_contents, '\n'); } } -Original Message- From: [EMAIL PROTECTED] on behalf of Miner, Jonathan W (US SSA) Sent: Tue 11/4/2008 4:54 PM To: NetworkManager-list@gnome.org Cc: Subject:blank lines added to /etc/hosts Hi - Each time I unplug, or reconnect my network cable, a blank line gets added to the end of /etc/hosts. # wc -l /etc/hosts 4 /etc/hosts (unplug my cable...) # wc -l /etc/hosts 5 /etc/hosts (plug cable back in...) # wc -l /etc/hosts 6 /etc/hosts Guessing that it is the g_string_append_c() call on line 309 of src/NetworkManagerPolicy.c which could needlessly add '\n' characters? ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list