systemd/hostname-setup-shortname.patch

26 lines
679 B
Diff
Raw Normal View History

Index: systemd-202/src/core/hostname-setup.c
===================================================================
--- systemd-202.orig/src/core/hostname-setup.c
+++ systemd-202/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
return -ENOENT;
}
+ /* strip any leftover of a domain name */
+ if (domain = strchr(s, '.')) {
+ *domain = NULL;
+ }
+
*hn = s;
return 0;
}