[PATCH i-g-t 3/4] core: Only display the errno message if errno is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux