use vfork when possible + small cleanups in mt init

This commit is contained in:
Jean-Francois Dockes
2012-11-18 08:33:33 +01:00
parent 86bc80d657
commit 62a8bff555
6 changed files with 175 additions and 125 deletions
+11 -7
View File
@@ -95,14 +95,18 @@ bool fsocc(const string &path, int *pc, long *blocks)
return true;
}
static const char *tmplocation()
static const string& tmplocation()
{
const char *tmpdir = getenv("RECOLL_TMPDIR");
if (!tmpdir)
tmpdir = getenv("TMPDIR");
if (!tmpdir)
tmpdir = "/tmp";
return tmpdir;
static string stmpdir;
if (stmpdir.empty()) {
const char *tmpdir = getenv("RECOLL_TMPDIR");
if (tmpdir == 0)
tmpdir = getenv("TMPDIR");
if (tmpdir == 0)
tmpdir = "/tmp";
stmpdir = string(tmpdir);
}
return stmpdir;
}
bool maketmpdir(string& tdir, string& reason)