Skip to content

Commit 0bb5531

Browse files
committed
utl: unique file name per process
Signed-off-by: osamahammad21 <[email protected]>
1 parent d8e07f5 commit 0bb5531

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utl/src/ScopedTemporaryFile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ std::string generate_unused_filename(const std::string& prefix)
2727
{
2828
int counter = 1;
2929
std::string filename;
30+
const auto pid = static_cast<unsigned int>(::getpid());
3031
do {
31-
filename = fmt::format("{}.{}", prefix, counter++);
32+
filename = fmt::format("{}.{}.{}", prefix, pid, counter++);
3233
} while (std::filesystem::exists(filename));
3334

3435
return filename;

0 commit comments

Comments
 (0)