diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/system/mktemp.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/mktemp.cpp')
-rw-r--r-- | util/system/mktemp.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/util/system/mktemp.cpp b/util/system/mktemp.cpp index 188fb1c7ea..505b7b4a4b 100644 --- a/util/system/mktemp.cpp +++ b/util/system/mktemp.cpp @@ -1,22 +1,22 @@ #include "tempfile.h" - + #include <util/folder/dirut.h> #include <util/generic/yexception.h> -#include <util/stream/file.h> - +#include <util/stream/file.h> + #include <cerrno> #include <cstring> #ifdef _win32_ - #include "winint.h" - #include <io.h> + #include "winint.h" + #include <io.h> #else - #include <unistd.h> - #include <stdlib.h> + #include <unistd.h> + #include <stdlib.h> #endif -extern "C" int mkstemps(char* path, int slen); - +extern "C" int mkstemps(char* path, int slen); + TString MakeTempName(const char* wrkDir, const char* prefix, const char* extension) { #ifndef _win32_ TString filePath; @@ -29,11 +29,11 @@ TString MakeTempName(const char* wrkDir, const char* prefix, const char* extensi if (filePath.back() != '/') { filePath += '/'; - } + } if (prefix) { filePath += prefix; - } + } filePath += "XXXXXX"; // mkstemps requirement @@ -45,7 +45,7 @@ TString MakeTempName(const char* wrkDir, const char* prefix, const char* extensi } filePath += extension; extensionPartLength += strlen(extension); - } + } int fd = mkstemps(const_cast<char*>(filePath.data()), extensionPartLength); if (fd >= 0) { @@ -55,7 +55,7 @@ TString MakeTempName(const char* wrkDir, const char* prefix, const char* extensi #else char tmpDir[MAX_PATH + 1]; // +1 -- for terminating null character char filePath[MAX_PATH]; - const char* pDir = 0; + const char* pDir = 0; if (wrkDir && *wrkDir) { pDir = wrkDir; @@ -68,6 +68,6 @@ TString MakeTempName(const char* wrkDir, const char* prefix, const char* extensi return filePath; } #endif - + ythrow TSystemError() << "can not create temp name(" << wrkDir << ", " << prefix << ", " << extension << ")"; -} +} |