aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-04-23 10:49:47 +0100
committerRon Yorston <rmy@pobox.com>2012-04-23 10:49:47 +0100
commit5fc2c035953f71992197f6025918a8fe79ade1d3 (patch)
treeda14db23267ba2dbe68d17fa667ed3a331efdca7 /libbb
parent9e26feebb1f6752fa21f4680a744cdc688366be5 (diff)
downloadbusybox-w32-5fc2c035953f71992197f6025918a8fe79ade1d3.tar.gz
busybox-w32-5fc2c035953f71992197f6025918a8fe79ade1d3.tar.bz2
busybox-w32-5fc2c035953f71992197f6025918a8fe79ade1d3.zip
win32: use uname/getdomainname in safe_gethostname.c
Diffstat (limited to 'libbb')
-rw-r--r--libbb/safe_gethostname.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c
index 16c966e58..bdb989631 100644
--- a/libbb/safe_gethostname.c
+++ b/libbb/safe_gethostname.c
@@ -35,7 +35,6 @@
35 */ 35 */
36char* FAST_FUNC safe_gethostname(void) 36char* FAST_FUNC safe_gethostname(void)
37{ 37{
38#if !ENABLE_PLATFORM_MINGW32
39 struct utsname uts; 38 struct utsname uts;
40 39
41 /* The length of the arrays in a struct utsname is unspecified; 40 /* The length of the arrays in a struct utsname is unspecified;
@@ -50,13 +49,6 @@ char* FAST_FUNC safe_gethostname(void)
50 /* Uname can fail only if you pass a bad pointer to it. */ 49 /* Uname can fail only if you pass a bad pointer to it. */
51 uname(&uts); 50 uname(&uts);
52 return xstrndup(!uts.nodename[0] ? "?" : uts.nodename, sizeof(uts.nodename)); 51 return xstrndup(!uts.nodename[0] ? "?" : uts.nodename, sizeof(uts.nodename));
53#else
54 /* We really don't care about people with host names wider than most screens */
55 char buf[256];
56 int r = gethostname(buf, sizeof(buf));
57 buf[sizeof(buf)-1] = '\0';
58 return xstrdup(r < 0 ? "?" : buf);
59#endif
60} 52}
61 53
62/* 54/*
@@ -72,8 +64,6 @@ char* FAST_FUNC safe_getdomainname(void)
72 struct utsname uts; 64 struct utsname uts;
73 uname(&uts); 65 uname(&uts);
74 return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname)); 66 return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname));
75#elif ENABLE_PLATFORM_MINGW32
76 return xstrdup("?");
77#else 67#else
78 /* We really don't care about people with domain names wider than most screens */ 68 /* We really don't care about people with domain names wider than most screens */
79 char buf[256]; 69 char buf[256];