2013-05-29 17:26:40 +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-02-13 10:43:21 +01:00
|
|
|
src/core/hostname-setup.c | 6 +++++-
|
|
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
2013-05-29 17:26:40 +02:00
|
|
|
|
2015-02-13 10:43:21 +01:00
|
|
|
Index: systemd-218/src/core/hostname-setup.c
|
|
|
|
===================================================================
|
|
|
|
--- systemd-218.orig/src/core/hostname-setup.c
|
|
|
|
+++ systemd-218/src/core/hostname-setup.c
|
2013-05-29 17:26:40 +02:00
|
|
|
@@ -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);
|
2015-02-13 10:43:21 +01:00
|
|
|
@@ -49,6 +49,10 @@ static int read_and_strip_hostname(const
|
2013-05-29 17:26:40 +02:00
|
|
|
return -ENOENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /* strip any leftover of a domain name */
|
2015-02-13 10:43:21 +01:00
|
|
|
+ if ((domain = strchr(s, '.')) != NULL)
|
|
|
|
+ *domain = '\0';
|
2013-05-29 17:26:40 +02:00
|
|
|
+
|
|
|
|
*hn = s;
|
|
|
|
return 0;
|
|
|
|
}
|