summaryrefslogtreecommitdiff
path: root/hostname-setup.c
diff options
context:
space:
mode:
authorMarc-Antoine Perennou <Marc-Antoine@Perennou.com>2010-05-09 18:13:02 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-09 19:12:28 +0200
commit3177a7fa12247d30b854fcb7697cd578b9086bf5 (patch)
treeceb596a9217ea720c7c6f49d5933fc97cd3715b4 /hostname-setup.c
parent07b0b134d3076fe223d6e15959b6081a74b56792 (diff)
hostname: read hostname for Gentoo
Diffstat (limited to 'hostname-setup.c')
-rw-r--r--hostname-setup.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hostname-setup.c b/hostname-setup.c
index 4d7f32d0a7..b8551d9802 100644
--- a/hostname-setup.c
+++ b/hostname-setup.c
@@ -40,11 +40,13 @@
#define FILENAME "/etc/hostname"
#elif defined(TARGET_ARCH)
#define FILENAME "/etc/rc.conf"
+#elif defined(TARGET_GENTOO)
+#define FILENAME "/etc/conf.d/hostname"
#endif
static int read_hostname(char **hn) {
-#if defined(TARGET_FEDORA) || defined(TARGET_ARCH)
+#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO)
int r;
FILE *f;
@@ -67,7 +69,7 @@ static int read_hostname(char **hn) {
s = strstrip(line);
- if (!startswith(s, "HOSTNAME="))
+ if (!startswith_no_case(s, "HOSTNAME="))
continue;
if (!(k = strdup(s+9))) {
@@ -75,6 +77,11 @@ static int read_hostname(char **hn) {
goto finish;
}
+ if (!(k = delete_chars(k, "\"\'"))) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
*hn = k;
break;
}