mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #2613 from oshogbo/gethostname
At least at FreeBSD - the gethostname(3) function can fail.
This commit is contained in:
commit
75634d460f
|
@ -179,7 +179,9 @@ BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
|
|||
char* dot;
|
||||
int length;
|
||||
char hostname[256];
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
return FALSE;
|
||||
length = strlen(hostname);
|
||||
dot = strchr(hostname, '.');
|
||||
|
||||
|
@ -208,7 +210,8 @@ BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD l
|
|||
if ((NameType == ComputerNameNetBIOS) || (NameType == ComputerNamePhysicalNetBIOS))
|
||||
return GetComputerNameA(lpBuffer, lpnSize);
|
||||
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
return FALSE;
|
||||
length = strlen(hostname);
|
||||
|
||||
switch (NameType)
|
||||
|
|
Loading…
Reference in New Issue