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>
This commit is contained in:
Damien Lespiau 2014-07-09 11:36:27 +01:00
parent b2d1a598ab
commit 4145462250

View File

@ -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 ?: "");
}
}