summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Mitz <mitza@ociweb.com>2015-11-12 15:59:41 -0600
committerAdam Mitz <mitza@ociweb.com>2015-11-12 15:59:41 -0600
commit52f30d9ddbfeac44a5197732ac65ee2c1ffadc39 (patch)
treefafd1a50332807fa9e0056467373bbd2b42b7d67
parentea348e2824a71fee2d77f4b4a0ee825b8bf41413 (diff)
downloadATCD-52f30d9ddbfeac44a5197732ac65ee2c1ffadc39.tar.gz
Use configurable temporary directory.
-rw-r--r--ACE/tests/Sendfile_Test.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/ACE/tests/Sendfile_Test.cpp b/ACE/tests/Sendfile_Test.cpp
index 2744eb5427d..8bb4c29500e 100644
--- a/ACE/tests/Sendfile_Test.cpp
+++ b/ACE/tests/Sendfile_Test.cpp
@@ -11,6 +11,8 @@
*/
#include "test_config.h"
+#include "ace/Lib_Find.h"
+#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_wait.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_fcntl.h"
@@ -86,13 +88,14 @@ client (void *arg)
for (i = 0; i < sizeof buffer; ++i)
buffer[i] = static_cast<u_char> (i);
- ACE_TCHAR const test_file[] = ACE_TEXT ("Sendfile_Test_File");
- ACE_HANDLE in_fd =
- ACE_OS::open (test_file,
- O_CREAT | O_RDWR | O_TRUNC,
- ACE_DEFAULT_FILE_PERMS);
-
- if (in_fd == ACE_INVALID_HANDLE)
+ const ACE_TCHAR file[] = ACE_TEXT ("Sendfile_Test_File");
+ static const size_t file_sz = sizeof (file) / sizeof (file[0]);
+ ACE_TCHAR test_file[MAXPATHLEN + 1];
+ ACE_HANDLE in_fd;
+ if (ACE::get_temp_dir (test_file, MAXPATHLEN - file_sz) == -1
+ || ACE_OS::strcat (test_file, file) == 0
+ || (in_fd = ACE_OS::open (test_file, O_CREAT | O_RDWR | O_TRUNC,
+ ACE_DEFAULT_FILE_PERMS)) == ACE_INVALID_HANDLE)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) open %p\n"), test_file));
Test_Result = 1;