2013-06-05 13:16:22 +02:00
|
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
|
|
Date: Tue, 28 May 2013 15:17:35 +0200
|
|
|
|
Subject: ensure shortname is set as hostname (bnc#820213)
|
|
|
|
|
|
|
|
strip hostname so the domain part isn't set as part of the hostname
|
|
|
|
---
|
2015-09-27 14:32:31 +02:00
|
|
|
src/core/hostname-setup.c | 4 ++++
|
|
|
|
1 file changed, 4 insertions(+)
|
2013-06-05 13:16:22 +02:00
|
|
|
|
2015-09-27 14:32:31 +02:00
|
|
|
Index: systemd-221/src/core/hostname-setup.c
|
2015-03-27 09:39:40 +01:00
|
|
|
===================================================================
|
2015-09-27 14:32:31 +02:00
|
|
|
--- systemd-221.orig/src/core/hostname-setup.c
|
|
|
|
+++ systemd-221/src/core/hostname-setup.c
|
|
|
|
@@ -34,6 +34,7 @@ int hostname_setup(void) {
|
2013-06-05 13:16:22 +02:00
|
|
|
int r;
|
2015-09-27 14:32:31 +02:00
|
|
|
_cleanup_free_ char *b = NULL;
|
|
|
|
const char *hn;
|
|
|
|
+ char *domain;
|
|
|
|
bool enoent = false;
|
2013-06-05 13:16:22 +02:00
|
|
|
|
2015-09-27 14:32:31 +02:00
|
|
|
r = read_hostname_config("/etc/hostname", &b);
|
|
|
|
@@ -46,6 +47,9 @@ int hostname_setup(void) {
|
|
|
|
hn = NULL;
|
|
|
|
} else
|
|
|
|
hn = b;
|
2013-06-05 13:16:22 +02:00
|
|
|
+ /* strip any leftover of a domain name */
|
2015-09-27 14:32:31 +02:00
|
|
|
+ if ((domain = strchr(hn, '.')) != NULL)
|
2015-03-27 09:39:40 +01:00
|
|
|
+ *domain = '\0';
|
2015-09-27 14:32:31 +02:00
|
|
|
|
|
|
|
if (isempty(hn)) {
|
|
|
|
/* Don't override the hostname if it is already set
|