diff OrthancServer/ServerJobs/ArchiveJob.cpp @ 3181:6fd38327e777

Fix issue #130 (Orthanc failed to start when /tmp partition was full)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 31 Jan 2019 15:33:27 +0100
parents beeeb6096f27
children e44e0127e553
line wrap: on
line diff
--- a/OrthancServer/ServerJobs/ArchiveJob.cpp	Wed Jan 30 17:50:51 2019 +0100
+++ b/OrthancServer/ServerJobs/ArchiveJob.cpp	Thu Jan 31 15:33:27 2019 +0100
@@ -39,6 +39,7 @@
 #include "../../Core/DicomParsing/DicomDirWriter.h"
 #include "../../Core/Logging.h"
 #include "../../Core/OrthancException.h"
+#include "../OrthancConfiguration.h"
 #include "../ServerContext.h"
 
 #include <stdio.h>
@@ -867,13 +868,20 @@
     
     if (synchronousTarget_.get() == NULL)
     {
-      asynchronousTarget_.reset(new TemporaryFile);
+      {
+        OrthancConfiguration::ReaderLock lock;
+        asynchronousTarget_.reset(lock.GetConfiguration().CreateTemporaryFile());
+      }
+
       target = asynchronousTarget_.get();
     }
     else
     {
       target = synchronousTarget_.get();
     }
+
+    assert(target != NULL);
+    target->Touch();  // Make sure we can write to the temporary file
     
     if (writer_.get() != NULL)
     {