aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@yandex-team.ru>2022-02-10 16:51:51 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:51:51 +0300
commit9f297e4a2d8d5767cf42b4047d45ad1f0483cce2 (patch)
treeab7fbbf3253d4c0e2793218f09378908beb025fb
parentb56e9714f9a7111f34a925e91abb846279eaea36 (diff)
downloadydb-9f297e4a2d8d5767cf42b4047d45ad1f0483cce2.tar.gz
Restoring authorship annotation for <alex@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--util/system/maxlen.h8
-rw-r--r--util/system/mktemp.cpp30
2 files changed, 19 insertions, 19 deletions
diff --git a/util/system/maxlen.h b/util/system/maxlen.h
index dced4999a3..e1ff7f5008 100644
--- a/util/system/maxlen.h
+++ b/util/system/maxlen.h
@@ -20,13 +20,13 @@
#define PATH_MAX _MAX_PATH
#endif
#else
-
+
#ifndef MAX_PATH
#define MAX_PATH PATH_MAX
#endif
-
+
#ifndef _MAX_PATH
#define _MAX_PATH PATH_MAX
#endif
-
-#endif
+
+#endif
diff --git a/util/system/mktemp.cpp b/util/system/mktemp.cpp
index 791ba6e116..505b7b4a4b 100644
--- a/util/system/mktemp.cpp
+++ b/util/system/mktemp.cpp
@@ -6,35 +6,35 @@
#include <cerrno>
#include <cstring>
-
-#ifdef _win32_
+
+#ifdef _win32_
#include "winint.h"
#include <io.h>
#else
#include <unistd.h>
#include <stdlib.h>
-#endif
+#endif
extern "C" int mkstemps(char* path, int slen);
TString MakeTempName(const char* wrkDir, const char* prefix, const char* extension) {
-#ifndef _win32_
+#ifndef _win32_
TString filePath;
-
+
if (wrkDir && *wrkDir) {
filePath += wrkDir;
} else {
filePath += GetSystemTempDir();
}
-
+
if (filePath.back() != '/') {
filePath += '/';
}
-
+
if (prefix) {
filePath += prefix;
}
-
+
filePath += "XXXXXX"; // mkstemps requirement
size_t extensionPartLength = 0;
@@ -46,28 +46,28 @@ 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) {
close(fd);
return filePath;
- }
-#else
+ }
+#else
char tmpDir[MAX_PATH + 1]; // +1 -- for terminating null character
char filePath[MAX_PATH];
const char* pDir = 0;
-
+
if (wrkDir && *wrkDir) {
- pDir = wrkDir;
+ pDir = wrkDir;
} else if (GetTempPath(MAX_PATH + 1, tmpDir)) {
pDir = tmpDir;
}
-
+
// it always takes up to 3 characters, no more
if (GetTempFileName(pDir, (prefix) ? (prefix) : "yan", 0, filePath)) {
return filePath;
}
-#endif
+#endif
ythrow TSystemError() << "can not create temp name(" << wrkDir << ", " << prefix << ", " << extension << ")";
}