diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-25 20:46:00 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-25 20:46:00 +0100 |
commit | 4113d7d1d89d6ad5fb47f56ad8ffa6049cd354b8 (patch) | |
tree | e8db218c6ec0955369eb3567892a6ddaf39c798e | |
parent | 98a61418e9b43fc56bf3c7bffc4238debf3fc4c7 (diff) | |
download | busybox-w32-4113d7d1d89d6ad5fb47f56ad8ffa6049cd354b8.tar.gz busybox-w32-4113d7d1d89d6ad5fb47f56ad8ffa6049cd354b8.tar.bz2 busybox-w32-4113d7d1d89d6ad5fb47f56ad8ffa6049cd354b8.zip |
Revise conditional compilation of safe_gethostname.c
-rw-r--r-- | libbb/safe_gethostname.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c index 33ca2b9f3..580baafab 100644 --- a/libbb/safe_gethostname.c +++ b/libbb/safe_gethostname.c | |||
@@ -69,12 +69,18 @@ char* FAST_FUNC safe_gethostname(void) | |||
69 | */ | 69 | */ |
70 | char* FAST_FUNC safe_getdomainname(void) | 70 | char* FAST_FUNC safe_getdomainname(void) |
71 | { | 71 | { |
72 | #if !ENABLE_PLATFORM_MINGW32 | 72 | #if defined(__linux__) |
73 | /* The field domainname of struct utsname is Linux specific. */ | 73 | /* The field domainname of struct utsname is Linux specific. */ |
74 | struct utsname uts; | 74 | struct utsname uts; |
75 | uname(&uts); | 75 | uname(&uts); |
76 | return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname)); | 76 | return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname)); |
77 | #else | 77 | #elif ENABLE_PLATFORM_MINGW32 |
78 | return xstrdup("?"); | 78 | return xstrdup("?"); |
79 | #else | ||
80 | /* We really don't care about people with domain names wider than most screens */ | ||
81 | char buf[256]; | ||
82 | int r = getdomainname(buf, sizeof(buf)); | ||
83 | buf[sizeof(buf)-1] = '\0'; | ||
84 | return xstrdup(r < 0 ? "?" : buf); | ||
79 | #endif | 85 | #endif |
80 | } | 86 | } |