aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/safe_gethostname.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c
index 233a6a418..33ca2b9f3 100644
--- a/libbb/safe_gethostname.c
+++ b/libbb/safe_gethostname.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "libbb.h" 27#include "libbb.h"
28#if defined(__linux__) 28#if !ENABLE_PLATFORM_MINGW32
29#include <sys/utsname.h> 29#include <sys/utsname.h>
30#endif 30#endif
31 31
@@ -37,7 +37,7 @@
37 */ 37 */
38char* FAST_FUNC safe_gethostname(void) 38char* FAST_FUNC safe_gethostname(void)
39{ 39{
40#if defined(__linux__) 40#if !ENABLE_PLATFORM_MINGW32
41 struct utsname uts; 41 struct utsname uts;
42 42
43 /* The length of the arrays in a struct utsname is unspecified; 43 /* The length of the arrays in a struct utsname is unspecified;
@@ -69,19 +69,12 @@ char* FAST_FUNC safe_gethostname(void)
69 */ 69 */
70char* FAST_FUNC safe_getdomainname(void) 70char* FAST_FUNC safe_getdomainname(void)
71{ 71{
72#if defined(__linux__) 72#if !ENABLE_PLATFORM_MINGW32
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#else
78 /* We really don't care about people with domain names wider than most screens */
79 /*
80 char buf[256];
81 int r = getdomainname(buf, sizeof(buf));
82 buf[sizeof(buf)-1] = '\0';
83 return xstrdup(r < 0 ? "?" : buf);
84 */
85 return xstrdup("?"); 78 return xstrdup("?");
86#endif 79#endif
87} 80}