aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mingw.h1
-rw-r--r--libbb/safe_gethostname.c10
2 files changed, 1 insertions, 10 deletions
diff --git a/include/mingw.h b/include/mingw.h
index 66296cfc8..2cae375a6 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -333,6 +333,7 @@ static inline void sync(void) {}
333NOIMPL(ttyname_r,int fd UNUSED_PARAM, char *buf UNUSED_PARAM, int sz UNUSED_PARAM); 333NOIMPL(ttyname_r,int fd UNUSED_PARAM, char *buf UNUSED_PARAM, int sz UNUSED_PARAM);
334int mingw_unlink(const char *pathname); 334int mingw_unlink(const char *pathname);
335NOIMPL(vfork,void); 335NOIMPL(vfork,void);
336NOIMPL(getdomainname, char *name UNUSED_PARAM, size_t len UNUSED_PARAM);
336 337
337#define dup2 mingw_dup2 338#define dup2 mingw_dup2
338#define getcwd mingw_getcwd 339#define getcwd mingw_getcwd
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];