diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-01-12 08:18:30 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-01-12 13:35:01 +0100 |
commit | 1a51e46e4a87e1cd9528ac5e5656011636e4086b (patch) | |
tree | 0120ca1d101beec6d0cf0532cdd4ab31aa95e211 /support/check.c | |
parent | 63b52889c35b367cf20896442203bbe5d123058c (diff) | |
download | glibc-1a51e46e4a87e1cd9528ac5e5656011636e4086b.tar.gz glibc-1a51e46e4a87e1cd9528ac5e5656011636e4086b.tar.xz glibc-1a51e46e4a87e1cd9528ac5e5656011636e4086b.zip |
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.
Diffstat (limited to 'support/check.c')
-rw-r--r-- | support/check.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/support/check.c b/support/check.c index 688ed569ac..78f2b3cde1 100644 --- a/support/check.c +++ b/support/check.c @@ -18,6 +18,7 @@ #include <support/check.h> +#include <errno.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -26,9 +27,11 @@ static void print_failure (const char *file, int line, const char *format, va_list ap) { + int saved_errno = errno; printf ("error: %s:%d: ", file, line); vprintf (format, ap); puts (""); + errno = saved_errno; } int |