Cygwin: gethostname: fix fetching hostname from non-winsock function

If gethostname() fails we call GetComputerNameEx with
ComputerNameDnsFullyQualified.  This is wrong, gethostname should return
the hostname only, not the FQDN.  Fix this by calling GetComputerNameEx
with ComputerNameDnsHostname.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2019-01-24 14:01:59 +01:00
parent 04e3dc1128
commit c6171b9fde
2 changed files with 3 additions and 1 deletions

View File

@@ -718,7 +718,7 @@ cygwin_gethostname (char *name, size_t len)
{
DWORD local_len = len;
if (!GetComputerNameExA (ComputerNameDnsFullyQualified, name,
if (!GetComputerNameExA (ComputerNameDnsHostname, name,
&local_len))
{
if (GetLastError () == ERROR_MORE_DATA)