From e7958bdcb89150c0907bc148b0b7032b67a42b00 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Fri, 14 Oct 2022 22:04:21 +0200
Subject: [PATCH] INIT: Better error reporting to find where it's failing on
 Ellio's computer

---
 src/base/config.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/base/config.c b/src/base/config.c
index 08deb304..824a5da3 100644
--- a/src/base/config.c
+++ b/src/base/config.c
@@ -347,8 +347,13 @@ retry_config:
         config_default_file(conf_file, conf_len);
         ___mkdir(conf_file); /* Create the folder for the file. */
 
+        errno = 0;
         FILE *file_desc = fopen(conf_file, "w+");
-        RETURN_UNLESS(file_desc, "Failed to open default config file to initialize it", 1);
+        if (file_desc != NULL) {
+            LOG_ERROR("INIT", "Failed to open default config file and initialize it");
+            LOG_ERROR("INTI", "Conf file is %s, errno is %d: %s", conf_file, errno, strerror(errno));
+            return 1;
+        }
         config_default(file_desc);
         fclose(file_desc);
 
-- 
GitLab