summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-01-31 16:56:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-01-31 16:57:17 +0000
commit48ad03ca0c5f078b8d12a64323fd93b3858041af (patch)
tree0c08dce3cc3f442b4f81a013489644b661427b7a /lib/drmtest.c
parentbe22e10885eba556428919c2bbc71b4b644cb1a4 (diff)
lib: Capture errno on entry
When printing the errno, it is important that we capture the user errno before we make any library calls - as they may alter the value. References: https://bugs.freedesktop.org/show_bug.cgi?id=74007 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 8bc70a35..f7262d7b 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1038,6 +1038,7 @@ void __igt_skip_check(const char *file, const int line,
const char *f, ...)
{
va_list args;
+ int err = errno;
if (f) {
static char *buf;
@@ -1053,12 +1054,12 @@ void __igt_skip_check(const char *file, const int line,
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Last errno: %i, %s\n"
"Test requirement: (%s)\n%s",
- func, file, line, errno, strerror(errno), check, buf);
+ func, file, line, err, strerror(err), check, buf);
} else {
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Last errno: %i, %s\n"
"Test requirement: (%s)\n",
- func, file, line, errno, strerror(errno), check);
+ func, file, line, err, strerror(err), check);
}
}
@@ -1110,11 +1111,12 @@ void __igt_fail_assert(int exitcode, const char *file,
const char *f, ...)
{
va_list args;
+ int err = errno;
printf("Test assertion failure function %s, file %s:%i:\n"
"Last errno: %i, %s\n"
"Failed assertion: %s\n",
- func, file, line, errno, strerror(errno), assertion);
+ func, file, line, err, strerror(err), assertion);
if (f) {
va_start(args, f);