From 1a51e46e4a87e1cd9528ac5e5656011636e4086b Mon Sep 17 00:00:00 2001 From: Florian Weimer 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/write_message.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'support/write_message.c') diff --git a/support/write_message.c b/support/write_message.c index 9d0f267..a3e2f90 100644 --- a/support/write_message.c +++ b/support/write_message.c @@ -18,12 +18,15 @@ #include +#include #include #include void write_message (const char *message) { + int saved_errno = errno; ssize_t unused __attribute__ ((unused)); unused = write (STDOUT_FILENO, message, strlen (message)); + errno = saved_errno; } -- cgit v1.1