ash: exec: Stricter pathopt parsing
[oweals/busybox.git] / libbb / safe_gethostname.c
index bdb98963113ffe8d613f48b0961e39aa93bf2025..b22e30ea355c43047fade0ce08510ac92fb94f8c 100644 (file)
@@ -6,7 +6,6 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
 /*
  * SUSv2 guarantees that "Host names are limited to 255 bytes"
  * POSIX.1-2001 guarantees that "Host names (not including the terminating
@@ -23,7 +22,6 @@
  * Host software MUST handle host names of up to 63 characters and
  * SHOULD handle host names of up to 255 characters.
  */
-
 #include "libbb.h"
 #include <sys/utsname.h>
 
@@ -50,25 +48,3 @@ char* FAST_FUNC safe_gethostname(void)
        uname(&uts);
        return xstrndup(!uts.nodename[0] ? "?" : uts.nodename, sizeof(uts.nodename));
 }
-
-/*
- * On success return the current malloced and NUL terminated domainname.
- * On error return malloced and NUL terminated string "?".
- * This is an illegal first character for a domainname.
- * The returned malloced string must be freed by the caller.
- */
-char* FAST_FUNC safe_getdomainname(void)
-{
-#if defined(__linux__)
-/* The field domainname of struct utsname is Linux specific. */
-       struct utsname uts;
-       uname(&uts);
-       return xstrndup(!uts.domainname[0] ? "?" : uts.domainname, sizeof(uts.domainname));
-#else
-       /* We really don't care about people with domain names wider than most screens */
-       char buf[256];
-       int r = getdomainname(buf, sizeof(buf));
-       buf[sizeof(buf)-1] = '\0';
-       return xstrdup(r < 0 ? "?" : buf);
-#endif
-}