mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 08:00:18 +01:00
hostname-manager: 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 <rworkman@slackware.com> https://mail.gnome.org/archives/networkmanager-list/2019-May/msg00011.html (cherry picked from commite1df17e0ac) (cherry picked from commit065e810424) (cherry picked from commit6160888e61)
This commit is contained in:
parent
869ac551cf
commit
fb8d30a3dd
1 changed files with 2 additions and 13 deletions
|
|
@ -133,8 +133,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;
|
||||
|
|
@ -144,17 +143,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue