summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 56469b32b5..eba5853ab0 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -813,6 +813,9 @@ int log_struct_internal(
* since vasprintf() leaves it afterwards at
* an undefined location */
+ if (error != 0)
+ errno = error;
+
va_copy(aq, ap);
if (vasprintf(&buf, format, aq) < 0) {
va_end(aq);
@@ -856,6 +859,9 @@ int log_struct_internal(
while (format) {
va_list aq;
+ if (error != 0)
+ errno = error;
+
va_copy(aq, ap);
vsnprintf(buf, sizeof(buf), format, aq);
va_end(aq);