changeset 3508:70524b4acc72

Name of temporary files now include the process ID to ease design of scripts cleaning /tmp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Aug 2019 11:41:26 +0200
parents 69e49fc044f8
children 5405d51e040d
files Core/TemporaryFile.cpp NEWS
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Core/TemporaryFile.cpp	Wed Aug 28 16:54:00 2019 +0200
+++ b/Core/TemporaryFile.cpp	Thu Aug 29 11:41:26 2019 +0200
@@ -63,7 +63,13 @@
     }
 
     // We use UUID to create unique path to temporary files
-    std::string filename = "Orthanc-" + Orthanc::Toolbox::GenerateUuid();
+    const std::string uuid = Orthanc::Toolbox::GenerateUuid();
+
+    // New in Orthanc 1.5.8: Prefix the process ID to the name of the
+    // temporary files, in order to locate orphan temporary files that
+    // were left by instances of Orthanc that exited in non-clean way
+    // https://groups.google.com/d/msg/orthanc-users/MSJX53bw6Lw/d3S3lRRLAwAJ
+    std::string filename = "Orthanc-" + boost::lexical_cast<std::string>(SystemToolbox::GetProcessId()) + "-" + uuid;
 
     if (extension != NULL)
     {
--- a/NEWS	Wed Aug 28 16:54:00 2019 +0200
+++ b/NEWS	Thu Aug 29 11:41:26 2019 +0200
@@ -6,6 +6,7 @@
 
 * Security: If remote access is enabled, HTTP authentication is also enabled by default
 * Log an explicit error if uploading an empty DICOM file using REST API
+* Name of temporary files now include the process ID to ease design of scripts cleaning /tmp
 * Fix compatibility of LSB binaries with Ubuntu >= 18.04
 * Fix generation of "SOP Instance UID" on split and merge