summaryrefslogtreecommitdiff
path: root/test/file.cpp
diff options
context:
space:
mode:
authorMadhavan Krishnan <madhavan.krishnan@linaro.org>2020-06-02 22:36:34 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-06-02 23:40:48 +0300
commit5f2f9406cebc668f0d69007d1ea59ef3c56ef28c (patch)
tree2ba18e5aba9093f97f8f238a2646dc2a9cd3c38e /test/file.cpp
parente239ded90bb820b8dfbe0725b1d5f965a9212299 (diff)
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 <madhavan.krishnan@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/file.cpp')
-rw-r--r--test/file.cpp5
1 files changed, 3 insertions, 2 deletions
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()