From d465e5fac63f36bcf4069e36827f4b62c494556d Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 27 May 2011 19:57:25 +0200 Subject: Imported Upstream version 0.8.9997 --- src/dhcp-manager/nm-dhcp-dhclient-utils.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/dhcp-manager') diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c index cc5255ab..caf90f11 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c @@ -14,7 +14,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2011 Red Hat, Inc. */ #include @@ -166,8 +166,19 @@ nm_dhcp_dhclient_create_config (const char *interface, } if (hostname) { - g_string_append_printf (new_contents, HOSTNAME_FORMAT "\n", hostname); + char *plain_hostname, *dot; + + plain_hostname = g_strdup (hostname); + dot = strchr (plain_hostname, '.'); + + /* get rid of the domain */ + if (dot) + *dot = '\0'; + + g_string_append_printf (new_contents, HOSTNAME_FORMAT "\n", plain_hostname); added = TRUE; + + g_free (plain_hostname); } if (added) -- cgit 1.3.0-6-gf8a5