From b771196d91245084784bf477f0e6aaf8642abffb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 29 Apr 2019 02:08:11 +0300 Subject: 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 Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- test/event.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/event.cpp b/test/event.cpp index 52bc0c7e..9bd87615 100644 --- a/test/event.cpp +++ b/test/event.cpp @@ -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(); -- cgit v1.2.1