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/write_message.c | |
parent | 63b52889c35b367cf20896442203bbe5d123058c (diff) | |
download | glibc-1a51e46e4a87e1cd9528ac5e5656011636e4086b.tar.gz |
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/write_message.c')
-rw-r--r-- | support/write_message.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/support/write_message.c b/support/write_message.c index 9d0f267a2f..a3e2f90535 100644 --- a/support/write_message.c +++ b/support/write_message.c @@ -18,12 +18,15 @@ #include <support/support.h> +#include <errno.h> #include <string.h> #include <unistd.h> 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; } |