diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-30 22:50:46 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-30 22:50:46 +0300 |
commit | 628f23ab62e342bb0b1dddedb563e7f13faf9528 (patch) | |
tree | 55c97c8453e2dc0036dfa65fb5eb268c886ada13 /plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc | |
parent | 67cd8dbde997606b40bd7dc2712ccc4c66d8d06f (diff) |
merge with the final version of libmdbx
Diffstat (limited to 'plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc')
-rw-r--r-- | plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc b/plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc index 7625e0f419..8132e267ef 100644 --- a/plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc +++ b/plugins/Dbx_mdbx/src/libmdbx/test/osal-unix.cc @@ -272,3 +272,22 @@ void osal_udelay(unsigned us) { } bool osal_istty(int fd) { return isatty(fd) == 1; } + +std::string osal_tempdir(void) { + const char *tempdir = getenv("TMPDIR"); + if (!tempdir) + tempdir = getenv("TMP"); + if (!tempdir) + tempdir = getenv("TEMPDIR"); + if (!tempdir) + tempdir = getenv("TEMP"); + if (tempdir) { + std::string dir(tempdir); + if (!dir.empty() && dir.at(dir.length() - 1) != '/') + dir.append("/"); + return dir; + } + if (access("/dev/shm/", R_OK | W_OK | X_OK) == 0) + return "/dev/shm/"; + return ""; +} |