From 60e4367d504cdf5afbb6bf9a2513ec67cc175dd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?=
 <janis.daehne@informatik.uni-halle.de>
Date: Mon, 30 Mar 2020 13:12:47 +0200
Subject: [PATCH] - prevent double output when the working dir could not be
 created

---
 api.php     | 2 +-
 helpers.php | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/api.php b/api.php
index 8dfe299..5aa4ae6 100644
--- a/api.php
+++ b/api.php
@@ -263,7 +263,7 @@ $paths = ensureDirs($rootDir, $transactionKey);
 
 if ($paths === FALSE) {
     endTransaction($conn, $config, $transactionKey, $rootDirName);
-    output($status_code_FileSystemIssue, "could not create dirs");
+    output($status_code_FileSystemIssue, "could not create dir(s)");
     exit(1);
 }
 
diff --git a/helpers.php b/helpers.php
index db5b973..8b58efc 100644
--- a/helpers.php
+++ b/helpers.php
@@ -318,11 +318,14 @@ function ensureDirs($currentRootDirName, $tempUserDirName)
     # use 777 so that every user can access e.g. if we use firejail with starts as another user...
     if (mkdir($fullWorkingDirPath, 0755, TRUE) === FALSE) {
 
+        # we output this in the calling method
         if ($isDebug) {
+            # os this will throw in the frontend but this is ok for debug...
             output($status_code_FileSystemIssue, 'could not create directory: ' . $fullWorkingDirPath);
-        } else {
-            output($status_code_FileSystemIssue, 'could not create directory');
         }
+        #else {
+        #    output($status_code_FileSystemIssue, 'could not create directory');
+        #}
 
         #umask($old);
         return FALSE;
-- 
GitLab