libcamera: Don't ignore the return value of read() and write()

The glibc read() and write() functions are defined with the
__warn_unused_result__ attribute when using FORTIFY_SOURCE. Don't ignore
their return value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2019-04-29 02:08:11 +03:00
parent 5caa8a971d
commit b771196d91
2 changed files with 26 additions and 4 deletions

View file

@ -38,6 +38,7 @@ protected:
EventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();
std::string data("H2G2");
Timer timeout;
ssize_t ret;
EventNotifier readNotifier(pipefd_[0], EventNotifier::Read);
readNotifier.activated.connect(this, &EventTest::readReady);
@ -46,7 +47,11 @@ protected:
memset(data_, 0, sizeof(data_));
size_ = 0;
write(pipefd_[1], data.data(), data.size());
ret = write(pipefd_[1], data.data(), data.size());
if (ret < 0) {
cout << "Pipe write failed" << endl;
return TestFail;
}
timeout.start(100);
dispatcher->processEvents();
@ -73,7 +78,11 @@ protected:
notified_ = false;
readNotifier.setEnabled(false);
write(pipefd_[1], data.data(), data.size());
ret = write(pipefd_[1], data.data(), data.size());
if (ret < 0) {
cout << "Pipe write failed" << endl;
return TestFail;
}
timeout.start(100);
dispatcher->processEvents();