summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index ff5924fa6bc..00447fc9ba1 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -149,8 +149,21 @@ const vespalib::string CUSTOM_COMPONENT_API_PATH = "/state/v1/custom/component";
VESPA_THREAD_STACK_TAG(proton_initialize_executor)
VESPA_THREAD_STACK_TAG(proton_close_executor)
+void ensureWritableDir(const vespalib::string &dirName) {
+ int pidnum = ::getpid();
+ int secnum = ::time(0);
+ auto pidstr = std::to_string(pidnum);
+ auto secstr = std::to_string(secnum);
+ auto filename = dirName + "/tmp.file." + pidstr + "." + secstr;
+ vespalib::File probe(filename);
+ probe.open(vespalib::File::CREATE);
+ probe.write("probe\n", 6, 0);
+ probe.close();
+ probe.unlink();
}
+} // namespace <unnamed>
+
Proton::ProtonFileHeaderContext::ProtonFileHeaderContext(const vespalib::string &creator)
: _hostName(),
_creator(creator),
@@ -278,6 +291,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot)
{
assert( _initStarted && ! _initComplete );
const ProtonConfig &protonConfig = configSnapshot->getProtonConfig();
+ ensureWritableDir(protonConfig.basedir);
const HwInfo & hwInfo = configSnapshot->getHwInfo();
_hw_info = hwInfo;