mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Added case for failure
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
#include "getcomputername.h"
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
BOOL GetComputerName(LPTSTR name, LPDWORD len)
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
int host = gethostname(name, HOST_NAME_MAX);
|
||||
if(host == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = ERROR_BUFFER_OVERFLOW;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user