[libcamera-devel] [PATCH] libcamera: test: Fixed the compilation issue
Madhavan Krishnan
madhavan.krishnan at linaro.org
Tue Jun 2 22:36:34 CEST 2020
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 <madhavan.krishnan at linaro.org>
---
test/file.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/file.cpp b/test/file.cpp
index 6262a6f..e328c01 100644
--- a/test/file.cpp
+++ b/test/file.cpp
@@ -27,13 +27,16 @@ protected:
{
fileName_ = "/tmp/libcamera.test.XXXXXX";
int fd = mkstemp(&fileName_.front());
+ ssize_t ret;
+
if (fd == -1)
return TestFail;
- write(fd, "libcamera", 9);
+ ret = write(fd, "libcamera", 9);
+
close(fd);
- return TestPass;
+ return ret == 9? TestPass : TestFail;
}
int run()
--
2.7.4
More information about the libcamera-devel
mailing list