summaryrefslogtreecommitdiff
path: root/libbb/safe_gethostname.c
diff options
context:
space:
mode:
authorJérémie Koenig2010-03-26 19:08:53 +0100
committerDenys Vlasenko2010-03-26 19:08:53 +0100
commitfbedacfc8caa1ec8f14e664a881cb0a93c8f8712 (patch)
tree6c08780bbaad6320149930bdbcfbee5a2eed9f5d /libbb/safe_gethostname.c
parent35fdb1bc9cb82fa5630c2d40ae49110ecd7c88ea (diff)
downloadbusybox-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.zip
busybox-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.gz
Hurd compat fixes. Mostly dealing with absent PATH_MAX
Signed-off-by: Jérémie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/safe_gethostname.c')
-rw-r--r--libbb/safe_gethostname.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c
index 7407fb7..e93254b 100644
--- a/libbb/safe_gethostname.c
+++ b/libbb/safe_gethostname.c
@@ -59,8 +59,12 @@ char* FAST_FUNC safe_gethostname(void)
*/
char* FAST_FUNC safe_getdomainname(void)
{
+/* The field domainname of struct utsname is Linux specific. */
+#if defined(__linux__)
struct utsname uts;
-
uname(&uts);
return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname));
+#else
+ return xstrdup("?");
+#endif
}