From 5f2f9406cebc668f0d69007d1ea59ef3c56ef28c Mon Sep 17 00:00:00 2001 From: Madhavan Krishnan Date: Tue, 2 Jun 2020 22:36:34 +0200 Subject: test: Fixed the compilation issue The return value of write() function is ignored, causing the following compiler error|warning with gcc version 5.4 error: ignoring return value of 'ssize_t write(int, const void*, size_t)' Fix this by storing the return value of write() and return a test error in case of failure. Reported-by: Coverity CID=284605 Signed-off-by: Madhavan Krishnan Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- test/file.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/file.cpp') diff --git a/test/file.cpp b/test/file.cpp index 6262a6f0..287831f3 100644 --- a/test/file.cpp +++ b/test/file.cpp @@ -30,10 +30,11 @@ protected: if (fd == -1) return TestFail; - write(fd, "libcamera", 9); + ssize_t ret = write(fd, "libcamera", 9); + close(fd); - return TestPass; + return ret == 9 ? TestPass : TestFail; } int run() -- cgit v1.2.1