systemd/ensure-shortname-is-set-as-hostname-bnc-820213.patch
Marcus Meissner 5715649b6b - Update to new upstream release 218
I really want networkd with a functioning machinectl --network-veth (broken in 13.2).

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=844
2015-02-13 09:43:21 +00:00

34 lines
976 B
Diff

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
---
src/core/hostname-setup.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: systemd-218/src/core/hostname-setup.c
===================================================================
--- systemd-218.orig/src/core/hostname-setup.c
+++ systemd-218/src/core/hostname-setup.c
@@ -32,7 +32,7 @@
#include "fileio.h"
static int read_and_strip_hostname(const char *path, char **hn) {
- char *s;
+ char *s, *domain;
int r;
assert(path);
@@ -49,6 +49,10 @@ static int read_and_strip_hostname(const
return -ENOENT;
}
+ /* strip any leftover of a domain name */
+ if ((domain = strchr(s, '.')) != NULL)
+ *domain = '\0';
+
*hn = s;
return 0;
}