chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hostname: read hostname for Gentoo
[elogind.git]
/
hostname-setup.c
diff --git
a/hostname-setup.c
b/hostname-setup.c
index 4d7f32d0a79b562432d46619e2df06b6d6ba3ba0..b8551d9802feb48715d8ebffdfa47c2d0c9b8777 100644
(file)
--- 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"
#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) {
#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;
int r;
FILE *f;
@@
-67,7
+69,7
@@
static int read_hostname(char **hn) {
s = strstrip(line);
s = strstrip(line);
- if (!startswith(s, "HOSTNAME="))
+ if (!startswith
_no_case
(s, "HOSTNAME="))
continue;
if (!(k = strdup(s+9))) {
continue;
if (!(k = strdup(s+9))) {
@@
-75,6
+77,11
@@
static int read_hostname(char **hn) {
goto finish;
}
goto finish;
}
+ if (!(k = delete_chars(k, "\"\'"))) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
*hn = k;
break;
}
*hn = k;
break;
}