summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLakshmi Priya Sekar <lasekar@microsoft.com>2016-01-24 14:50:28 -0800
committerLakshmi Priya Sekar <lasekar@microsoft.com>2016-01-24 22:07:23 -0800
commitd27273525d7fb7361f7577d373a1e82e9eae884d (patch)
treebee8d3074da13ed7092af7f9856261cf2dd53d68 /src
parentce1f5a27b5191ea385d9d087aa60cc380faa3976 (diff)
downloadcoreclr-d27273525d7fb7361f7577d373a1e82e9eae884d.tar.gz
coreclr-d27273525d7fb7361f7577d373a1e82e9eae884d.tar.bz2
coreclr-d27273525d7fb7361f7577d373a1e82e9eae884d.zip
Fix build breaks and ensure GetComputerNameW is included in mscorlib.
Diffstat (limited to 'src')
-rw-r--r--src/dlls/mscoree/mscorwks_unixexports.src1
-rw-r--r--src/pal/src/misc/identity.cpp14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CMakeLists.txt1
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.c7
-rw-r--r--src/pal/tests/palsuite/paltestlist.txt1
5 files changed, 11 insertions, 13 deletions
diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src
index fe4f2a4350..7120337177 100644
--- a/src/dlls/mscoree/mscorwks_unixexports.src
+++ b/src/dlls/mscoree/mscorwks_unixexports.src
@@ -43,6 +43,7 @@ FlushFileBuffers
FormatMessageW
FreeEnvironmentStringsW
GetACP
+GetComputerNameW
GetConsoleCP
GetConsoleOutputCP
GetCurrentDirectoryW
diff --git a/src/pal/src/misc/identity.cpp b/src/pal/src/misc/identity.cpp
index 6be3c9d8ac..498ad49dcd 100644
--- a/src/pal/src/misc/identity.cpp
+++ b/src/pal/src/misc/identity.cpp
@@ -167,7 +167,7 @@ GetUserNameW(
while (NULL == pPasswd)
{
- pchBuffer = (char*) InternalMalloc(pPalThread, sizeof(pchBuffer[0]) * dwBufLen);
+ pchBuffer = (char*) PAL_malloc(sizeof(pchBuffer[0]) * dwBufLen);
if (NULL == pchBuffer)
{
pPalThread->SetLastError(ERROR_OUTOFMEMORY);
@@ -182,7 +182,7 @@ GetUserNameW(
if (ERANGE == iRet) // need a bigger buffer
{
- InternalFree(pPalThread, pchBuffer);
+ PAL_free(pchBuffer);
pchBuffer = NULL;
pPasswd = NULL;
dwBufLen *= 2; // double the buffer
@@ -274,12 +274,12 @@ done:
#if HAVE_GETPWUID_R
if (NULL != pchBuffer)
{
- InternalFree(pPalThread, pchBuffer);
+ PAL_free(pchBuffer);
}
#else // HAVE_GETPWUID_R
if (NULL != szUserName)
{
- InternalFree(pPalThread, szUserName);
+ PAL_free(szUserName);
}
#endif // HAVE_GETPWUID_R
@@ -343,12 +343,6 @@ GetComputerNameW(
*pchDot = '\0'; // remove the domain name info
}
- // clip the hostname to MAX_COMPUTERNAME_LENGTH
- if (sizeof(szHostName) > MAX_COMPUTERNAME_LENGTH)
- {
- szHostName[MAX_COMPUTERNAME_LENGTH] = '\0';
- }
-
// copy the hostname (including NULL character)
cwchLen = MultiByteToWideChar(CP_ACP, 0, szHostName, -1, lpBuffer, *nSize);
if (0 == cwchLen)
diff --git a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt
index 800e303f14..86f194198b 100644
--- a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt
+++ b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt
@@ -8,6 +8,7 @@ add_subdirectory(FlushInstructionCache)
add_subdirectory(FormatMessageW)
add_subdirectory(FreeEnvironmentStringsW)
add_subdirectory(GetCommandLineW)
+add_subdirectory(GetComputerNameW)
add_subdirectory(GetEnvironmentStringsW)
add_subdirectory(GetEnvironmentVariableA)
add_subdirectory(GetEnvironmentVariableW)
diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.c b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.c
index ad01ed0dea..fa82620d1b 100644
--- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.c
+++ b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.c
@@ -18,7 +18,8 @@
int __cdecl main(int argc, char *argv[])
{
- WCHAR wzComputerName[MAX_COMPUTERNAME_LENGTH+1];
+ int HOST_NAME_MAX = 255;
+ WCHAR wzComputerName[HOST_NAME_MAX+1];
DWORD dwSize = sizeof(wzComputerName)/sizeof(wzComputerName[0]);
// Initialize the PAL and return FAILURE if this fails
@@ -32,8 +33,8 @@ int __cdecl main(int argc, char *argv[])
Fail("ERROR: GetComputerName failed with %d!\n", GetLastError());
}
- // dwSize is the length of wzComputerName without NULL
- if (dwSize <= 0 || dwSize > (sizeof(wzComputerName)/sizeof(wzComputerName[0]) - 1))
+ // dwSize is the length of wzComputerName without NULL
+ if (dwSize < 0 || dwSize > (sizeof(wzComputerName)/sizeof(wzComputerName[0]) - 1))
{
Fail("ERROR: GetComputerName returned %S with dwSize = %u whereas the passed in buffer size is %d!\n",
wzComputerName, dwSize, sizeof(wzComputerName)/sizeof(wzComputerName[0]));
diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt
index f8c4ee7290..44386ac30e 100644
--- a/src/pal/tests/palsuite/paltestlist.txt
+++ b/src/pal/tests/palsuite/paltestlist.txt
@@ -642,6 +642,7 @@ miscellaneous/FormatMessageW/test3/paltest_formatmessagew_test3
miscellaneous/FreeEnvironmentStringsW/test1/paltest_freeenvironmentstringsw_test1
miscellaneous/FreeEnvironmentStringsW/test2/paltest_freeenvironmentstringsw_test2
miscellaneous/GetCommandLineW/test1/paltest_getcommandlinew_test1
+miscellaneous/GetComputerNameW/test1/paltest_getcomputernamew_test1
miscellaneous/GetEnvironmentStringsW/test1/paltest_getenvironmentstringsw_test1
miscellaneous/GetEnvironmentVariableA/test1/paltest_getenvironmentvariablea_test1
miscellaneous/GetEnvironmentVariableA/test2/paltest_getenvironmentvariablea_test2