comparison 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
comparison
equal deleted inserted replaced
3180:07a2f637b76d 3181:6fd38327e777
37 #include "../../Core/Cache/SharedArchive.h" 37 #include "../../Core/Cache/SharedArchive.h"
38 #include "../../Core/Compression/HierarchicalZipWriter.h" 38 #include "../../Core/Compression/HierarchicalZipWriter.h"
39 #include "../../Core/DicomParsing/DicomDirWriter.h" 39 #include "../../Core/DicomParsing/DicomDirWriter.h"
40 #include "../../Core/Logging.h" 40 #include "../../Core/Logging.h"
41 #include "../../Core/OrthancException.h" 41 #include "../../Core/OrthancException.h"
42 #include "../OrthancConfiguration.h"
42 #include "../ServerContext.h" 43 #include "../ServerContext.h"
43 44
44 #include <stdio.h> 45 #include <stdio.h>
45 46
46 #if defined(_MSC_VER) 47 #if defined(_MSC_VER)
865 { 866 {
866 TemporaryFile* target = NULL; 867 TemporaryFile* target = NULL;
867 868
868 if (synchronousTarget_.get() == NULL) 869 if (synchronousTarget_.get() == NULL)
869 { 870 {
870 asynchronousTarget_.reset(new TemporaryFile); 871 {
872 OrthancConfiguration::ReaderLock lock;
873 asynchronousTarget_.reset(lock.GetConfiguration().CreateTemporaryFile());
874 }
875
871 target = asynchronousTarget_.get(); 876 target = asynchronousTarget_.get();
872 } 877 }
873 else 878 else
874 { 879 {
875 target = synchronousTarget_.get(); 880 target = synchronousTarget_.get();
876 } 881 }
882
883 assert(target != NULL);
884 target->Touch(); // Make sure we can write to the temporary file
877 885
878 if (writer_.get() != NULL) 886 if (writer_.get() != NULL)
879 { 887 {
880 throw OrthancException(ErrorCode_BadSequenceOfCalls); 888 throw OrthancException(ErrorCode_BadSequenceOfCalls);
881 } 889 }