SHA256
1
0
forked from pool/systemd
systemd/0003-strip-the-domain-part-from-etc-hostname-when-setting.patch

40 lines
1.5 KiB
Diff
Raw Normal View History

From 54366ae306ae19bdb2a5af7eb5158260cdc37e8f Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 28 May 2013 15:17:35 +0200
Subject: [PATCH 1/1] strip the domain part from /etc/hostname when setting
system host name
[fbui: fixes bnc#820213]
[fbui: forwardported from bfd2462b8ddec591d953841ab22bb30bdc6f9085]
[fbui: adjust context and make sure that strip of the domain name is
only done when setting the system host name. Therefore it's
still possible to pass an FQDN to hostnamectl]
[fbui: I'm still not sure that it was the right thing to do. Other
possibility was to fix the installer to create a correct
/etc/hostname file. Need to investigate...]
---
src/shared/hostname-setup.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/shared/hostname-setup.c b/src/shared/hostname-setup.c
index 511aa7d031..351d0e761d 100644
--- a/src/shared/hostname-setup.c
+++ b/src/shared/hostname-setup.c
@@ -189,6 +189,13 @@ int hostname_setup(bool really) {
else
log_warning_errno(r, "Failed to read configured hostname: %m");
} else {
+ char *domain;
+
+ /* SUSE: strip the domain name */
+ domain = strchr(b, '.');
+ if (domain)
+ *domain = '\0';
+
hn = b;
source = HOSTNAME_STATIC;
}
--
2.26.2