From dc8d11f52e5eda900c9b7dc06aab19567b1c9a50 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 10 Jan 2003 12:55:47 +0000 Subject: [PATCH] * autoload.cc (gethostname): Make call optional, return 1 if function can't get loaded. * net.cc (cygwin_gethostname): Call GetComputerName if return value of gethostname is non-zero. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/autoload.cc | 2 +- winsup/cygwin/net.cc | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9172cc0b3..01338e106 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2003-01-10 Corinna Vinschen + + * autoload.cc (gethostname): Make call optional, return 1 if function + can't get loaded. + * net.cc (cygwin_gethostname): Call GetComputerName if return value + of gethostname is non-zero. + 2003-01-10 Charles Wilson * cygwin.din: add asprintf and vasprintf, as well as the reentrant diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 5210623a0..2d75604cb 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -445,7 +445,7 @@ LoadDLLfunc (closesocket, 4, wsock32) LoadDLLfunc (connect, 12, wsock32) LoadDLLfunc (gethostbyaddr, 12, wsock32) LoadDLLfunc (gethostbyname, 4, wsock32) -LoadDLLfunc (gethostname, 8, wsock32) +LoadDLLfuncEx2 (gethostname, 8, wsock32, 1, 1) LoadDLLfunc (getpeername, 12, wsock32) LoadDLLfunc (getprotobyname, 4, wsock32) LoadDLLfunc (getprotobynumber, 4, wsock32) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index b558ad78b..b55e439b4 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -896,7 +896,7 @@ cygwin_gethostname (char *name, size_t len) if (__check_null_invalid_struct_errno (name, len)) return -1; - if (gethostname (name, len) == SOCKET_ERROR) + if (gethostname (name, len)) { DWORD local_len = len;