Skip to content

Commit

Permalink
Merge branch 'OPENDDS-715-fix-warnings' of github.com:objectcomputing…
Browse files Browse the repository at this point in the history
…/OpenDDS into OPENDDS-715-fix-warnings

(cherry picked from commit 29eb4e7)
  • Loading branch information
ocielliottc authored and mitza-oci committed Apr 26, 2024
1 parent ceaeee4 commit 56ed01e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions performance-tests/bench/common/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <ace/Lib_Find.h> // For ACE::get_temp_dir
#include <ace/OS_NS_string.h> // For ACE_OS::strcpy
#include <ace/OS_NS_sys_stat.h> // For ACE_OS::mkdir and ACE_OS::stat
#include <ace/OS_NS_stdlib.h> // For ACE_OS::mktemp

#include <iostream>
#include <exception>
Expand Down Expand Up @@ -62,21 +61,20 @@ std::string& string_replace(std::string& input, const std::string& oldstr, const

std::string create_temp_dir(const std::string& prefix)
{
// Create Template for mktemp
ACE_TCHAR buffer[PATH_MAX];
// Create the buffer for the path
ACE_TCHAR buffer[PATH_MAX] = ACE_TEXT("");
if (ACE::get_temp_dir(&buffer[0], PATH_MAX) == -1) {
return "";
}
ACE_OS::strcpy(
&buffer[0],
ACE_TEXT_CHAR_TO_TCHAR(join_path(
ACE_TEXT_ALWAYS_CHAR(&buffer[0]),
(prefix + "_XXXXXX")).c_str()));
ACE_TEXT_ALWAYS_CHAR(&buffer[0]), prefix).c_str()));

// Fill the template and create the directory
if (!ACE_OS::mktemp(buffer)) {
return "";
}
// Append the process id and create the directory
const size_t len = ACE_OS::strlen(buffer);
ACE_OS::snprintf(buffer + len, PATH_MAX - len - 1,
"_%d", ACE_OS::getpid());
if (ACE_OS::mkdir(buffer, S_IRWXU) == -1) {
return "";
}
Expand Down

0 comments on commit 56ed01e

Please sign in to comment.