From 1a51e46e4a87e1cd9528ac5e5656011636e4086b Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 12 Jan 2018 08:18:30 +0100
Subject: support: Preserve errno in write_message, TEST_VERIFY and other
 checks

These facilities could clobber errno, which makes it difficult to write
certain checks because a specific order has to be used.
---
 support/support_test_verify_impl.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'support/support_test_verify_impl.c')

diff --git a/support/support_test_verify_impl.c b/support/support_test_verify_impl.c
index 80311a8265..5ff5555a6a 100644
--- a/support/support_test_verify_impl.c
+++ b/support/support_test_verify_impl.c
@@ -18,14 +18,17 @@
 
 #include <support/check.h>
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 void
 support_test_verify_impl (const char *file, int line, const char *expr)
 {
+  int saved_errno = errno;
   support_record_failure ();
   printf ("error: %s:%d: not true: %s\n", file, line, expr);
+  errno = saved_errno;
 }
 
 void
-- 
cgit v1.2.3-70-g09d2