lockfile: only compute and log once

This commit is contained in:
Jean-Francois Dockes 2021-11-13 10:30:09 +01:00
parent 2c60e382f8
commit 310d28a4a1

View File

@ -1398,7 +1398,8 @@ string RclConfig::getIdxStatusFile() const
// Thanks to user Madhu for this fix.
string RclConfig::getPidfile() const
{
string fn;
static string fn;
if (fn.empty()) {
#ifndef _WIN32
const char *p = getenv("XDG_RUNTIME_DIR");
string rundir;
@ -1428,6 +1429,7 @@ string RclConfig::getPidfile() const
fn = path_cat(getCacheDir(), "index.pid");
out:
LOGINF("RclConfig: pid/lock file: " << fn << "\n");
}
return fn;
}