[Intel-gfx] [PATCH i-g-t 3/4] core: Only display the errno message if errno is set
Damien Lespiau
damien.lespiau at intel.com
Wed Jul 9 12:45:20 CEST 2014
Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
lib/igt_core.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 4dbcb1a..e66d096 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -575,6 +575,10 @@ void __igt_skip_check(const char *file, const int line,
{
va_list args;
int err = errno;
+ char *err_str = NULL;
+
+ if (err)
+ asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err));
if (f) {
static char *buf;
@@ -589,16 +593,18 @@ void __igt_skip_check(const char *file, const int line,
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Test requirement: (%s)\n%s"
- "Last errno: %i, %s\n",
- func, file, line, check, buf, err, strerror(err));
+ "%s",
+ func, file, line, check, buf, err_str ?: "");
free(buf);
} else {
igt_skip("Test requirement not met in function %s, file %s:%i:\n"
"Test requirement: (%s)\n"
- "Last errno: %i, %s\n",
- func, file, line, check, err, strerror(err));
+ "%s",
+ func, file, line, check, err_str ?: "");
}
+
+ free(err_str);
}
/**
--
1.8.3.1
More information about the Intel-gfx
mailing list