Added case for failure

This commit is contained in:
Aaron
2015-07-30 12:46:28 -07:00
parent 920322c809
commit bf92f710e8
+9 -2
View File
@@ -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;
}
}