diff options
Diffstat (limited to 'newlib/libc/sys/linux/gethostname.c')
-rw-r--r-- | newlib/libc/sys/linux/gethostname.c | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/newlib/libc/sys/linux/gethostname.c b/newlib/libc/sys/linux/gethostname.c deleted file mode 100644 index ef526916f..000000000 --- a/newlib/libc/sys/linux/gethostname.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2002, Red Hat Inc. */ - -#include <errno.h> -#include <string.h> -#include <unistd.h> -#include <sys/utsname.h> -#include <machine/weakalias.h> - -int -__gethostname (char *name, size_t len) -{ - struct utsname nodebuf; - size_t nodelen; - - if (uname (&nodebuf)) - return -1; - - nodelen = strlen (nodebuf.nodename) + 1; - if (len < nodelen) - memcpy (name, nodebuf.nodename, len); - else - memcpy (name, nodebuf.nodename, nodelen); - - if (nodelen > len) - { - errno = ENAMETOOLONG; - return -1; - } - return 0; -} -weak_alias(__gethostname, gethostname) |