diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2014-07-09 11:36:27 +0100 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2014-07-10 18:05:25 +0100 |
commit | 41454622506d2d060cba8c6f1cbe98a359936a2b (patch) | |
tree | ef1e084296e46b3a9896834bd906ee1fe411b856 /lib | |
parent | b2d1a598aba4fe6b4128a0eb99f6da95a9fc70fc (diff) |
core: Only display the errno message if errno is set
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c index f683c3b5..03c1f61f 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,13 +593,13 @@ 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 ?: ""); } 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 ?: ""); } } |