From f4a34028cde674b9a49ebc4841c510b8c2268733 Mon Sep 17 00:00:00 2001
From: Stephan Schulz <stephan.schulz-x2q@rub.de>
Date: Tue, 9 Feb 2021 14:05:41 +0100
Subject: [PATCH] properly check output directories access permissions

---
 include/ALL.hpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/ALL.hpp b/include/ALL.hpp
index 52efc82..f0c685e 100644
--- a/include/ALL.hpp
+++ b/include/ALL.hpp
@@ -822,10 +822,11 @@ private:
     errno = 0;
     mode_t mode = S_IRWXU | S_IRWXG; // rwx for user and group
     if(mkdir(filename, mode)) {
-      if(errno == EEXIST) return;
-      throw FilesystemErrorException(
-          __FILE__, __func__, __LINE__,
-          "Could not create output directory.");
+      if(errno != EEXIST) {
+        throw FilesystemErrorException(
+            __FILE__, __func__, __LINE__,
+            "Could not create output directory.");
+      }
     }
     // check permission in case directory already existed, but had wrong
     // permissions
-- 
GitLab