From 29e75ee76c7ac596446333aae29426ad8f91537c Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Fri, 10 Oct 2014 21:58:31 +0000 Subject: Pick up changes from this set: Commit ad906bbed19 ChangeLogTag:Thu Oct 9 16:21:38 UTC 2014 Steve Huston --- ACE/ChangeLog | 40 +++++++ ACE/NEWS | 123 +++++++++++++++++++++ ACE/ace/FILE_Addr.cpp | 13 ++- ACE/ace/MMAP_Memory_Pool.cpp | 9 ++ ACE/ace/OS_NS_stdio.h | 6 +- ACE/ace/OS_NS_stdio.inl | 2 + ACE/ace/OS_NS_stdlib.cpp | 4 +- ACE/ace/OS_NS_stdlib.h | 12 +- ACE/ace/OS_NS_stdlib.inl | 21 ++-- ACE/ace/README | 4 + ACE/apps/drwho/File_Manager.cpp | 5 +- ACE/apps/mkcsregdb/mkcsregdb.cpp | 26 ++++- ACE/examples/OS/Process/imore.cpp | 21 +++- .../IPC-tests/client/local_dgram_client_test.cpp | 5 +- ACE/tests/MM_Shared_Memory_Test.cpp | 6 +- ACE/tests/Naming_Test.cpp | 17 ++- ACE/tests/Svc_Handler_Test.cpp | 16 ++- 17 files changed, 282 insertions(+), 48 deletions(-) diff --git a/ACE/ChangeLog b/ACE/ChangeLog index ff740f76495..90a3ddba8a9 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,43 @@ +Thu Oct 9 16:21:38 UTC 2014 Steve Huston + + * NEWS: Add description of the below changes. + + * ace/OS_NS_stdlib.{h inl cpp}: + * ace/OS_NS_stdio.{h inl}: + * ace/README: + Added new feature config macros ACE_DISABLE_MKTEMP and + ACE_DISABLE_TEMPNAM. These disable the ACE wrappers for + mktemp() and tempnam(), respectively. Those functions are + considered insecure and better replaced by the use of mkstemp(). + + * ace/FILE_Addr.cpp (set): Call to set(const ACE_FILE_Addr&) using + the default "any" address will now fail if ACE_DISABLE_MKTEMP is + set. + + * ace/FILE_Connector.cpp (connect): Specifying 'any' for the + address now uses ACE_OS::mkstemp(). Contrast this with setting a + ACE_FILE_Addr with 'any', above. + + * ace/MMAP_Memory_Pool.cpp (constructor): Using the 'unique' option + will no longer work if ACE_DISABLE_MKTEMP is set. + + * tests/MM_Shared_Memory_Test.cpp: + Will not work if ACE_DISABLE_MKTEMP is set. + + * tests/Naming_Test.cpp: + Changed to avoid use of ACE_OS::tempnam. + + * tests/Svc_Handler_Test.cpp: Modified to work with or without + ACE_DISABLE_MKTEMP. + + * apps/mkcsregdb/mkcsregdb.cpp: + * apps/drwho/File_Manager.cpp: + Use ACE_OS::mkstemp. + + * examples/OS/Process/imore.cpp: + * examples/Service_Configurator/IPC-tests/client/local_dgram_client.cpp: + Won't work if ACE_DISABLE_TEMPNAM is set. + Mon May 27 10:09:24 CEST 2013 Johnny Willemsen * ACE version 6.2.0 released. diff --git a/ACE/NEWS b/ACE/NEWS index 222743f30cf..8c9d7c74946 100644 --- a/ACE/NEWS +++ b/ACE/NEWS @@ -1,3 +1,126 @@ +USER VISIBLE CHANGES BETWEEN ACE-6.2.8 and ACE-6.2.9 +==================================================== + +. New config macros were added: + ACE_DISABLE_MKTEMP: Disables the availability of ACE_OS::mktemp(). + ACE_DISABLE_TEMPNAM: Disables the availability of ACE_OS::tempnam(). + These can be added to your $ACE_ROOT/ace/config.h to disable these + wrappers which are considered to be a potential security risk. Disabling + one or both will also disable the following: + - ACE_FILE_Addr::set () with the 'any' address specified. + - ACE_MMAP_Memory_Pool use of the 'unique' option. + +USER VISIBLE CHANGES BETWEEN ACE-6.2.7 and ACE-6.2.8 +==================================================== + +. Add new ACE::make_event_handler() which is similar + to std::make_shared but than for allocation of ACE + event handlers. This template method is only enabled + when ACE_HAS_CPP11 has been defined, which is set + automatically when a C++ compiler with adequate + C++11 support is used. Also ACE_Event_Handler_var is + extended with some C++11 specific operations + +. For all reactor types calling cancel_timer with a + nullptr is now allowed, will result in a return of 0 + +. ACE_DLL and ACE_DLL_Manager have been extended with + the support to retrieve any dynamic loader errors + +USER VISIBLE CHANGES BETWEEN ACE-6.2.6 and ACE-6.2.7 +==================================================== + +. Added configuration files for Microsoft Visual Studio 2014 + +. Added configuration files for MacOSX Yosemite + +. Added configuration files for IBM AIX XL C++ 12.1 + +USER VISIBLE CHANGES BETWEEN ACE-6.2.5 and ACE-6.2.6 +==================================================== + +. Resolved several data races reported by Intel Inspector XE + +. Added optional socket connection optimization for Windows + +. Improve functionality and stability of running tests on + Android Virtual Device (AVD). + +USER VISIBLE CHANGES BETWEEN ACE-6.2.4 and ACE-6.2.5 +==================================================== + +. Added the ability to build RPMs for just ACE, using an ACE-src tarball. + To do this add "--without tao" to the rpmbuild command line. + +. Added support for Embarcadero C++Builder XE5 using + bcc32 in debug and release mode + +. Added support for Embarcadero C++Builder XE6 using + bcc32 in debug and release mode + +. When Intel C++ 2013 SP1 Update 2 is used with C++11 enabled + as compiler feature now also ACE_HAS_CPP11 will be defined, + this compiler is now able to compile all our C++11 feature + tests + +. Fixed several boundary bugs in the ACE RLE Compressor + +USER VISIBLE CHANGES BETWEEN ACE-6.2.3 and ACE-6.2.4 +==================================================== + +. Added support for FC20 and ended support for FC19 + +. Extended C++11 feature test suite + +. Improved support for MingW64 + +. Improvements to IPv6 support on Windows + +USER VISIBLE CHANGES BETWEEN ACE-6.2.2 and ACE-6.2.3 +==================================================== + +. The ACE_OS::thr_join() method will detect if the thread to be waited on is + the calling thread and avert that deadlock. The support needed for this + method is available at Vista/Windows Server 2003 and higher; to enable + the deadlock prevention, compile ACE with _WIN32_WINNT=0x0502 or higher. + +. Ended maintenance and support for FC12 CEEL + +. Further improvements of the Android port: Added new define + ACE_HAS_EXPLICIT_TEMPLATE_CLASS_INSTANTIATION and related macros + ACE_SINGLETON_TEMPLATE_INSTANTIATION and ACE_SINGLETON_TEMPLATE_INSTANTIATE + providing a cleaner way to support explicit template (static member or class) + instantiation. + +' Improvements of the test framework for running tests in a mixed environment + where different targets run on different physiscal devices (possibly having + different OS). + +USER VISIBLE CHANGES BETWEEN ACE-6.2.1 and ACE-6.2.2 +==================================================== + +. The max_len argument to ACE_Process::command_line_buf changed from int* + to size_t*. This corrects a mismatch between the argument type and the + data member in ACE_Process from which the value comes. + +. Removed some include files from ACE.h. These were not required for ACE. + The removed includes are OS_NS_math, Flag_Manip, Handle_Ops, Lib_Find, + Init_ACE, Sock_Connect.h. You may have to explicitly add one of these + in your own code to restore compiling. + +. Further improvements of the Android port, still work in progress. + +USER VISIBLE CHANGES BETWEEN ACE-6.2.0 and ACE-6.2.1 +==================================================== + +. Added support for Fedora 19, ended daily maintenance + for Fedora 17 and 18 + +. Added support for Embarcadero C++BuilderXE4 using + bcc32 in debug and release mode + +. Improved support for Android + USER VISIBLE CHANGES BETWEEN ACE-6.1.9 and ACE-6.2.0 ==================================================== diff --git a/ACE/ace/FILE_Addr.cpp b/ACE/ace/FILE_Addr.cpp index c501f0ee615..60c783caaa5 100644 --- a/ACE/ace/FILE_Addr.cpp +++ b/ACE/ace/FILE_Addr.cpp @@ -28,11 +28,17 @@ ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) { if (sa.get_type () == AF_ANY) { -#if defined (ACE_DEFAULT_TEMP_FILE) +#if defined (ACE_DISABLE_MKTEMP) + // Built without mktemp support; punt back to caller. + errno = ENOTSUP; + return -1; +#else + +# if defined (ACE_DEFAULT_TEMP_FILE) // Create a temporary file. ACE_OS::strcpy (this->filename_, ACE_DEFAULT_TEMP_FILE); -#else /* ACE_DEFAULT_TEMP_FILE */ +# else /* ACE_DEFAULT_TEMP_FILE */ if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 15) == -1) // -15 for ace-file-XXXXXX { @@ -45,12 +51,13 @@ ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) // Add the filename to the end ACE_OS::strcat (this->filename_, ACE_TEXT ("ace-fileXXXXXX")); -#endif /* ACE_DEFAULT_TEMP_FILE */ +# endif /* ACE_DEFAULT_TEMP_FILE */ if (ACE_OS::mktemp (this->filename_) == 0) return -1; this->base_set (AF_FILE, static_cast (ACE_OS::strlen (this->filename_) + 1)); +#endif /* ACE_DISABLE_MKTEMP */ } else { diff --git a/ACE/ace/MMAP_Memory_Pool.cpp b/ACE/ace/MMAP_Memory_Pool.cpp index e5eb2a4be1a..385ec9513b7 100644 --- a/ACE/ace/MMAP_Memory_Pool.cpp +++ b/ACE/ace/MMAP_Memory_Pool.cpp @@ -180,7 +180,16 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool ( // If requested an unique filename, use mktemp to get a random file. if (options && options->unique_) +# if defined (ACE_DISABLE_MKTEMP) + { + ACELIB_ERROR ((LM_ERROR, + ACE_TEXT ("mktemp disabled; ") + ACE_TEXT ("can't generate unique name"))); + this->backing_store_name_[0] = 0; + } +# else ACE_OS::mktemp(this->backing_store_name_); +# endif /* ACE_DISABLE_MKTEMP */ #endif /* ACE_DEFAULT_BACKING_STORE */ } else diff --git a/ACE/ace/OS_NS_stdio.h b/ACE/ace/OS_NS_stdio.h index 761db883356..a95d12ee20e 100644 --- a/ACE/ace/OS_NS_stdio.h +++ b/ACE/ace/OS_NS_stdio.h @@ -489,15 +489,17 @@ namespace ACE_OS { int sprintf (wchar_t *buf, const wchar_t *format, ...); # endif /* ACE_HAS_WCHAR */ +# if !defined (ACE_DISABLE_TEMPNAM) ACE_NAMESPACE_INLINE_FUNCTION char *tempnam (const char *dir = 0, const char *pfx = 0); -#if defined (ACE_HAS_WCHAR) +# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *tempnam (const wchar_t *dir, const wchar_t *pfx = 0); -#endif /* ACE_HAS_WCHAR */ +# endif /* ACE_HAS_WCHAR */ +# endif /* !ACE_DISABLE_TEMPNAM */ ACE_NAMESPACE_INLINE_FUNCTION int vasprintf (char **bufp, const char *format, va_list argptr) diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl index 60031b4fd63..22960290c16 100644 --- a/ACE/ace/OS_NS_stdio.inl +++ b/ACE/ace/OS_NS_stdio.inl @@ -873,6 +873,7 @@ ACE_OS::rewind (FILE *fp) #endif /* ACE_HAS_WINCE */ } +#if !defined (ACE_DISABLE_TEMPNAM) ACE_INLINE char * ACE_OS::tempnam (const char *dir, const char *pfx) { @@ -924,6 +925,7 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx) #endif /* ACE_LACKS_TEMPNAM */ } #endif /* ACE_HAS_WCHAR */ +#endif /* !ACE_DISABLE_TEMPNAM */ ACE_INLINE int ACE_OS::vasprintf (char **bufp, const char* format, va_list argptr) diff --git a/ACE/ace/OS_NS_stdlib.cpp b/ACE/ace/OS_NS_stdlib.cpp index 9f13021519a..cd47f1d63ab 100644 --- a/ACE/ace/OS_NS_stdlib.cpp +++ b/ACE/ace/OS_NS_stdlib.cpp @@ -277,7 +277,7 @@ ACE_OS::malloc (size_t nbytes) return ACE_MALLOC_FUNC (nbytes); } -#if defined (ACE_LACKS_MKTEMP) +#if defined (ACE_LACKS_MKTEMP) && !defined (ACE_DISBALE_MKTEMP) ACE_TCHAR * ACE_OS::mktemp (ACE_TCHAR *s) { @@ -325,7 +325,7 @@ ACE_OS::mktemp (ACE_TCHAR *s) return s; } } -#endif /* ACE_LACKS_MKTEMP */ +#endif /* ACE_LACKS_MKTEMP &7 !ACE_DISABLE_MKTEMP */ void * ACE_OS::realloc (void *ptr, size_t nbytes) diff --git a/ACE/ace/OS_NS_stdlib.h b/ACE/ace/OS_NS_stdlib.h index fb9f9c18161..e4f18ea5e8b 100644 --- a/ACE/ace/OS_NS_stdlib.h +++ b/ACE/ace/OS_NS_stdlib.h @@ -231,18 +231,20 @@ namespace ACE_OS { ACE_HANDLE mkstemp_emulation (ACE_TCHAR * s); #endif /* ACE_LACKS_MKSTEMP */ -#if !defined (ACE_LACKS_MKTEMP) +#if !defined (ACE_DISABLE_MKTEMP) +# if !defined (ACE_LACKS_MKTEMP) ACE_NAMESPACE_INLINE_FUNCTION char *mktemp (char *s); -# if defined (ACE_HAS_WCHAR) +# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *mktemp (wchar_t *s); -# endif /* ACE_HAS_WCHAR */ -#else +# endif /* ACE_HAS_WCHAR */ +# else extern ACE_Export ACE_TCHAR *mktemp (ACE_TCHAR *s); -#endif /* !ACE_LACKS_MKTEMP */ +# endif /* !ACE_LACKS_MKTEMP */ +#endif /* !ACE_DISABLE_MKTEMP */ ACE_NAMESPACE_INLINE_FUNCTION int putenv (const char *string); diff --git a/ACE/ace/OS_NS_stdlib.inl b/ACE/ace/OS_NS_stdlib.inl index 1281440caab..ce40934ac31 100644 --- a/ACE/ace/OS_NS_stdlib.inl +++ b/ACE/ace/OS_NS_stdlib.inl @@ -267,24 +267,26 @@ ACE_OS::mkstemp (wchar_t *s) } #endif /* ACE_HAS_WCHAR */ -#if !defined (ACE_LACKS_MKTEMP) +#if !defined (ACE_DISABLE_MKTEMP) + +# if !defined (ACE_LACKS_MKTEMP) ACE_INLINE char * ACE_OS::mktemp (char *s) { -# if defined (ACE_WIN32) +# if defined (ACE_WIN32) return ::_mktemp (s); -# else /* ACE_WIN32 */ +# else /* ACE_WIN32 */ return ::mktemp (s); -# endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ } -# if defined (ACE_HAS_WCHAR) +# if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::mktemp (wchar_t *s) { -# if defined (ACE_WIN32) +# if defined (ACE_WIN32) return ::_wmktemp (s); -# else +# else // For narrow-char filesystems, we must convert the wide-char input to // a narrow-char string for mktemp (), then convert the name back to // wide-char for the caller. @@ -294,11 +296,12 @@ ACE_OS::mktemp (wchar_t *s) ACE_Ascii_To_Wide wide_s (narrow_s.char_rep ()); ACE_OS::strcpy (s, wide_s.wchar_rep ()); return s; -# endif +# endif } # endif /* ACE_HAS_WCHAR */ -#endif /* !ACE_LACKS_MKTEMP */ +# endif /* !ACE_LACKS_MKTEMP */ +#endif /* !ACE_DISABLE_MKTEMP */ ACE_INLINE int ACE_OS::putenv (const char *string) diff --git a/ACE/ace/README b/ACE/ace/README index 520e218e443..346e8c765c9 100644 --- a/ACE/ace/README +++ b/ACE/ace/README @@ -32,6 +32,10 @@ ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES ACE_OS::default_win32_security_attributes as the default security object. +ACE_DISABLE_MKTEMP Disable availability of + ACE_OS::mktemp(). +ACE_DISABLE_TEMPNAM Disable availability of + ACE_OS::tempnam(). ACE_DISABLE_DEBUG_DLL_CHECK Define this if you don't want debug version ACE search for debug version DLLs first diff --git a/ACE/apps/drwho/File_Manager.cpp b/ACE/apps/drwho/File_Manager.cpp index 30df49cf8d7..8acb846f5a2 100644 --- a/ACE/apps/drwho/File_Manager.cpp +++ b/ACE/apps/drwho/File_Manager.cpp @@ -73,8 +73,9 @@ File_Manager::get_login_and_real_name (const char *&login_name, const char *&rea int File_Manager::open_passwd_file (void) { - const char *filename = ACE_OS::tempnam (); - FILE *fp = ACE_OS::fopen (filename, "w"); + char *filename = "passwd-XXXXXX"; + ACE_HANDLE f = ACE_OS::mkstemp (filename); + FILE *fp = ACE_OS::fdopen (f, "w"); if (fp == 0) return -1; diff --git a/ACE/apps/mkcsregdb/mkcsregdb.cpp b/ACE/apps/mkcsregdb/mkcsregdb.cpp index bdb112c14b8..7b3ff7fffa7 100644 --- a/ACE/apps/mkcsregdb/mkcsregdb.cpp +++ b/ACE/apps/mkcsregdb/mkcsregdb.cpp @@ -42,7 +42,7 @@ private: char *line_data_; ifstream *inf_; FILE *outf_; - char *tempfilename_; + char tempfilename_[MAXPATHLEN]; char *ace_src_; }; @@ -68,6 +68,7 @@ csdb_generator::csdb_generator () outf_ (0) { ace_src_ = ACE_OS::getenv("ACE_ROOT"); + tempfilename_[0] = '\0'; } void @@ -227,10 +228,25 @@ csdb_generator::init_output (const char *srcfile) ACE_ERROR_RETURN ((LM_ERROR,"You must first set $ACE_ROOT\n"),-1); time_t now = ACE_OS::time(); - tempfilename_ = ACE_OS::tempnam (ace_src_,"csdb"); - outf_ = ACE_OS::fopen (tempfilename_,"w"); - if (outf_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to open output file, %s\n",tempfilename_),-1); + if (ACE_OS::strlen(ace_src_) > 0) + { + ACE_OS::sprintf (tempfilename_, + "%s%s%s", + ace_src_, + ACE_DIRECTORY_SEPARATOR_STR, + "csdbXXXXXX"); + } + else + { + ACE_OS::strcpy (tempfilename_, "csdbXXXXXX"); + } + int fd = ACE_OS::mkstemp (tempfilename_); + if (fd == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open output file, %p\n", + tempfilename_), + -1); + outf_ = ACE_OS::fdopen (fd, "w"); ACE_OS::fprintf (outf_,"// $ID: $\n"); ACE_OS::fprintf (outf_,"/*\n * Codeset registry DB, generated %s * source: %s\n", diff --git a/ACE/examples/OS/Process/imore.cpp b/ACE/examples/OS/Process/imore.cpp index 98bac0ba53a..ae3cf491fe1 100644 --- a/ACE/examples/OS/Process/imore.cpp +++ b/ACE/examples/OS/Process/imore.cpp @@ -89,7 +89,7 @@ parse_args (int argc, ACE_TCHAR **argv) return 0; } -#if !defined (ACE_WIN32) +#if !defined (ACE_WIN32) && !defined (ACE_DISABLE_TEMPNAM) static int setup_named_pipes (ACE_Process_Options &opt) { @@ -227,9 +227,22 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) #if !defined (ACE_WIN32) ACE_Process_Options options; - if ((use_named_pipe ? ::setup_named_pipes : - ::setup_unnamed_pipe) (options) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Error, bailing out!\n"), -1); + if (use_named_pipe) + { +# if defined (ACE_DISABLE_TEMPNAM) + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_DISABLE_TEMPNAM set; can't use named pipes\n"), + -1); +# else + if (::setup_named_pipes (options) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "Error, bailing out!\n"), -1); +# endif /* ACE_DISABLE_TEMPNAM */ + } + else + { + if (::setup_unnamed_pipe (options) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "Error, bailing out!\n"), -1); + } options.command_line (executable); if (new_process.spawn (options) == -1) diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp index 616f6bc40ee..f7e6cc6111f 100644 --- a/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp +++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp @@ -13,7 +13,8 @@ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" -#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) +#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) && \ + !defined (ACE_DISABLE_TEMPNAM) // Name of the program. static ACE_TCHAR *program_name; @@ -113,7 +114,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("your platform must support sendmsg/recvmsg to run this test\n")), + ACE_TEXT ("your platform must support sendmsg/recvmsg and tempnam to run this test\n")), -1); } #endif /* ACE_HAS_MSG */ diff --git a/ACE/tests/MM_Shared_Memory_Test.cpp b/ACE/tests/MM_Shared_Memory_Test.cpp index c320d8a6a96..1dcb13c65cb 100644 --- a/ACE/tests/MM_Shared_Memory_Test.cpp +++ b/ACE/tests/MM_Shared_Memory_Test.cpp @@ -194,7 +194,7 @@ run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("MM_Shared_Memory_Test")); -#if !defined (ACE_LACKS_MMAP) +#if !defined (ACE_LACKS_MMAP) && !defined (ACE_DISABLE_MKTEMP) ACE_TCHAR temp_file[MAXPATHLEN + 1]; // Get the temporary directory, @@ -219,8 +219,8 @@ run_main (int, ACE_TCHAR *[]) #else /* !ACE_LACKS_MMAP */ ACE_ERROR ((LM_INFO, - ACE_TEXT ("mmap ") - ACE_TEXT ("is not supported on this platform\n"))); + ACE_TEXT ("mmap and mktemp") + ACE_TEXT ("are required for this test\n"))); #endif /* !ACE_LACKS_MMAP */ ACE_END_TEST; diff --git a/ACE/tests/Naming_Test.cpp b/ACE/tests/Naming_Test.cpp index a6a01c95442..e48866e7c18 100644 --- a/ACE/tests/Naming_Test.cpp +++ b/ACE/tests/Naming_Test.cpp @@ -244,8 +244,7 @@ run_main (int argc, ACE_TCHAR *argv[]) // for Tru64 when the current directory is NFS mounted from a // system that does not properly support locking. ACE_TCHAR temp_dir [MAXPATHLEN]; - if (ACE::get_temp_dir (temp_dir, MAXPATHLEN - 15) == -1) - // -15 for ace-file-XXXXXX + if (ACE::get_temp_dir (temp_dir, MAXPATHLEN) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Temporary path too long, ") @@ -256,11 +255,17 @@ run_main (int argc, ACE_TCHAR *argv[]) { ACE_OS::chdir (temp_dir); } - ACE_OS::strcpy (temp_file, pname); - ACE_OS::strcat (temp_file, ACE_TEXT ("XXXXXX")); + // Set the database name using the pid. mktemp isn't always available. + ACE_OS::snprintf(temp_file, BUFSIZ, +#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + ACE_TEXT ("%ls%d"), +#else + ACE_TEXT ("%s%d"), +#endif + pname, + ACE_OS::getpid ()); - // Set the database name using mktemp to generate a unique file name - name_options->database (ACE_OS::mktemp (temp_file)); + name_options->database (temp_file); } if (ns_context->open (ACE_Naming_Context::PROC_LOCAL, 1) == -1) { diff --git a/ACE/tests/Svc_Handler_Test.cpp b/ACE/tests/Svc_Handler_Test.cpp index 7c7358c3e45..cfe2f2f5561 100644 --- a/ACE/tests/Svc_Handler_Test.cpp +++ b/ACE/tests/Svc_Handler_Test.cpp @@ -87,13 +87,19 @@ run_main (int argc, ACE_TCHAR *argv[]) ACE_FILE_Connector connector; ACE_FILE_IO file_io; // Create a temporary filename. - ACE_FILE_Addr file (ACE_sap_any_cast (ACE_FILE_Addr &)); - // Open up the temp file. - if (connector.connect (file_io, file) == -1) + // Open up a temp file. + if (connector.connect (file_io, ACE_sap_any_cast (ACE_FILE_Addr &)) == -1) ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("connect failed for %p\n"), - file.get_path_name ()), + ACE_TEXT ("%p\n"), + ACE_TEXT ("connect")), + 1); + // Find the name of the temp file + ACE_FILE_Addr file; + if (file_io.get_local_addr (file) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("get_local_addr")), 1); // Create the service handler and assign it as its data -- cgit v1.2.1