>From 53676bdf67e1132df02b61416fe03027213afdcc Mon Sep 17 00:00:00 2001 From: "Patrick J. Volkerding" Date: Mon, 13 Nov 2017 00:17:38 -0600 Subject: [PATCH] nm-hostname-manager.c: Use fqdn for persistent hostname on Slackware This will be the default for Slackware 15.0 and on. This should be safe for both master and 1.12.x stable branch, as no existing Slackware releases are expected to run NM-1.12.x or later. Signed-off-by: Robby Workman --- src/nm-hostname-manager.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/nm-hostname-manager.c b/src/nm-hostname-manager.c index 3fcd84826..db5611160 100644 --- a/src/nm-hostname-manager.c +++ b/src/nm-hostname-manager.c @@ -131,8 +131,7 @@ read_hostname_slackware (const char *path) { gs_free char *contents = NULL; gs_strfreev char **all_lines = NULL; - char *tmp; - guint i, j = 0; + guint i = 0; if (!g_file_get_contents (path, &contents, NULL, NULL)) return NULL; @@ -142,17 +141,7 @@ read_hostname_slackware (const char *path) g_strstrip (all_lines[i]); if (all_lines[i][0] == '#' || all_lines[i][0] == '\0') continue; - tmp = &all_lines[i][0]; - /* We only want up to the first '.' -- the rest of the */ - /* fqdn is defined in /etc/hosts */ - while (tmp[j] != '\0') { - if (tmp[j] == '.') { - tmp[j] = '\0'; - break; - } - j++; - } - return g_shell_unquote (tmp, NULL); + return g_shell_unquote (&all_lines[i][0], NULL); } return NULL; } -- 2.21.0