35 lines
961 B
Diff
35 lines
961 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 | 7 ++++++-
|
||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
|
||
|
index 0ce683b..1c8e555 100644
|
||
|
--- a/src/core/hostname-setup.c
|
||
|
+++ b/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,11 @@ static int read_and_strip_hostname(const char *path, char **hn) {
|
||
|
return -ENOENT;
|
||
|
}
|
||
|
|
||
|
+ /* strip any leftover of a domain name */
|
||
|
+ if (domain = strchr(s, '.')) {
|
||
|
+ *domain = NULL;
|
||
|
+ }
|
||
|
+
|
||
|
*hn = s;
|
||
|
return 0;
|
||
|
}
|