diff options
Diffstat (limited to 'libbb/safe_gethostname.c')
-rw-r--r-- | libbb/safe_gethostname.c | 6 |
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 } |