log_error(): Fix segmentation fault
authorFabian Keil <fk@fabiankeil.de>
Tue, 9 Sep 2025 11:57:44 +0000 (13:57 +0200)
committerFabian Keil <fk@fabiankeil.de>
Thu, 9 Oct 2025 09:51:07 +0000 (11:51 +0200)
... when logging %E on a platform that isn't Windows
and doesn't have strerror().

Reported by Joshua Rogers.

errlog.c

index da6af45..a3fb378 100644 (file)
--- a/errlog.c
+++ b/errlog.c
@@ -843,7 +843,7 @@ void log_error(int loglevel, const char *fmt, ...)
 #ifdef HAVE_STRERROR
             format_string = strerror(ival);
 #else /* ifndef HAVE_STRERROR */
-            format_string = NULL;
+            format_string = "Unable to convert errno to string.";
 #endif /* ndef HAVE_STRERROR */
             if (sval == NULL)
             {