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>
This commit is contained in:
Madhavan Krishnan 2020-06-02 22:36:34 +02:00 committed by Laurent Pinchart
parent e239ded90b
commit 5f2f9406ce

View file

@ -30,10 +30,11 @@ protected:
if (fd == -1) if (fd == -1)
return TestFail; return TestFail;
write(fd, "libcamera", 9); ssize_t ret = write(fd, "libcamera", 9);
close(fd); close(fd);
return TestPass; return ret == 9 ? TestPass : TestFail;
} }
int run() int run()