Skip to content

Commit

Permalink
added uuid to CreateTempFilePath to avoid duplicated names (linux onl…
Browse files Browse the repository at this point in the history
…y) (aws#534)

* added uuid to the CreateTempFilePath method, to avoid duplicated names on temp files created on the same milisecond (linux platform only).
  • Loading branch information
KaibaLopez authored Jul 30, 2019
1 parent f00eaea commit 03467da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aws-cpp-sdk-core/source/platform/linux-shared/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <aws/core/utils/DateTime.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UUID.h>

#include <unistd.h>
#include <pwd.h>
Expand Down Expand Up @@ -259,7 +260,8 @@ Aws::String CreateTempFilePath()
{
Aws::StringStream ss;
auto dt = Aws::Utils::DateTime::Now();
ss << dt.ToGmtString("%Y%m%dT%H%M%S") << dt.Millis();

ss << dt.ToGmtString("%Y%m%dT%H%M%S") << dt.Millis() << Aws::String(Aws::Utils::UUID::RandomUUID());
Aws::String tempFile(ss.str());

AWS_LOGSTREAM_DEBUG(FILE_SYSTEM_UTILS_LOG_TAG, "CreateTempFilePath generated: " << tempFile);
Expand Down

0 comments on commit 03467da

Please sign in to comment.