summaryrefslogtreecommitdiff
path: root/ACE/tests/Naming_Test.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2008-11-10 12:54:18 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2008-11-10 12:54:18 +0000
commite1f95a0f9841cd5e66489ccc1f8cced940aba91e (patch)
treeda9ec38e9b01f1f7ac7e4347c6d77a4682355e74 /ACE/tests/Naming_Test.cpp
parent88677ee3bfa890688e498aad902e2e829cc94136 (diff)
downloadATCD-e1f95a0f9841cd5e66489ccc1f8cced940aba91e.tar.gz
Mon Nov 10 12:53:00 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ACE/tests/Naming_Test.cpp')
-rw-r--r--ACE/tests/Naming_Test.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/ACE/tests/Naming_Test.cpp b/ACE/tests/Naming_Test.cpp
index 1a905291184..89322d86f26 100644
--- a/ACE/tests/Naming_Test.cpp
+++ b/ACE/tests/Naming_Test.cpp
@@ -227,9 +227,9 @@ run_main (int argc, ACE_TCHAR *argv[])
# if defined (linux) && defined (__x86_64__)
name_options->base_address ((char*)0x3c00000000);
#endif
- int unicode = 0;
+ bool unicode = false;
#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
- unicode = 1;
+ unicode = true;
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
if (unicode && name_options->use_registry () == 1)
{
@@ -238,24 +238,28 @@ run_main (int argc, ACE_TCHAR *argv[])
}
else
{
+ const ACE_TCHAR* pname = ACE::basename (name_options->process_name (),
+ ACE_DIRECTORY_SEPARATOR_CHAR);
// Allow the user to determine where the context file will be
// located just in case the current directory is not suitable for
// locking. We don't just set namespace_dir () on name_options
// because that is not sufficient to work around locking problems
// for Tru64 when the current directory is NFS mounted from a
// system that does not properly support locking.
- const char* temp_envs[] = { "TMPDIR", "TEMP", "TMP", 0 };
- for(const char** temp_env = temp_envs; *temp_env != 0; ++temp_env)
+ ACE_TCHAR temp_dir [MAXPATHLEN];
+ if (ACE::get_temp_dir (temp_dir, MAXPATHLEN - 15) == -1)
+ // -15 for ace-file-XXXXXX
{
- char* temp_dir = ACE_OS::getenv(*temp_env);
- if (temp_dir != 0)
- {
- ACE_OS::chdir (temp_dir);
- break;
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Temporary path too long, ")
+ ACE_TEXT ("defaulting to current directory\n")),
+ -1);
+ }
+ else
+ {
+ ACE_OS::chdir (temp_dir);
}
- ACE_OS::strcpy (temp_file, ACE::basename (name_options->process_name (),
- ACE_DIRECTORY_SEPARATOR_CHAR));
+ ACE_OS::strcpy (temp_file, pname);
ACE_OS::strcat (temp_file, ACE_TEXT ("XXXXXX"));
// Set the database name using mktemp to generate a unique file name