aboutsummaryrefslogtreecommitdiff
path: root/libbb/safe_gethostname.c
diff options
context:
space:
mode:
authorGravatar Jérémie Koenig <jk@jk.fr.eu.org>2010-03-26 19:08:53 +0100
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2010-03-26 19:08:53 +0100
commitfbedacfc8caa1ec8f14e664a881cb0a93c8f8712 (patch)
tree6c08780bbaad6320149930bdbcfbee5a2eed9f5d /libbb/safe_gethostname.c
parent35fdb1bc9cb82fa5630c2d40ae49110ecd7c88ea (diff)
downloadbusybox-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.gz
busybox-fbedacfc8caa1ec8f14e664a881cb0a93c8f8712.tar.bz2
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 7407fb782..e93254b2b 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
}