From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 6 Sep 2024 11:41:22 +0000 (+0200)
Subject: init_error_log(): Include the reason for failures to open the log file
X-Git-Tag: v_4_0_0~60^2~8
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/static/user-manual/coding.html?a=commitdiff_plain;h=e8fab94f10ad67c52ceb425c4912c4725728f441;p=privoxy.git

init_error_log(): Include the reason for failures to open the log file
---

diff --git a/errlog.c b/errlog.c
index 3446b721..da6af45e 100644
--- a/errlog.c
+++ b/errlog.c
@@ -339,7 +339,7 @@ void init_error_log(const char *prog_name, const char *logfname)
        * reopen it if the file name changed or if the
        * configuration reload was caused by a SIGHUP.
        */
-      log_error(LOG_LEVEL_INFO, "Failed to reopen logfile: \'%s\'. "
+      log_error(LOG_LEVEL_INFO, "Failed to reopen logfile: \'%s\': %E. "
          "Retrying after closing the old file descriptor first. If that "
          "doesn't work, Privoxy will exit without being able to log a message.",
          logfname);
@@ -352,7 +352,8 @@ void init_error_log(const char *prog_name, const char *logfname)
 
    if (NULL == fp)
    {
-      log_error(LOG_LEVEL_FATAL, "init_error_log(): can't open logfile: \'%s\'", logfname);
+      log_error(LOG_LEVEL_FATAL,
+         "init_error_log(): can't open logfile \'%s\': %E", logfname);
    }
 
 #ifdef FEATURE_EXTERNAL_FILTERS