Patch Detail
Show a patch.
GET /api/1.1/patches/1123/?format=api
{ "id": 1123, "url": "https://patchwork.libcamera.org/api/1.1/patches/1123/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1123/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190428231238.30547-1-laurent.pinchart@ideasonboard.com>", "date": "2019-04-28T23:12:37", "name": "[libcamera-devel,1/2] libcamera: Don't ignore the return value of read() and write()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9693cc463a88c9654a419ab016b1a9e46167051e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1123/mbox/", "series": [ { "id": 280, "url": "https://patchwork.libcamera.org/api/1.1/series/280/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=280", "date": "2019-04-28T23:12:37", "name": "[libcamera-devel,1/2] libcamera: Don't ignore the return value of read() and write()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/280/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1123/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1123/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E427600EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Apr 2019 01:12:57 +0200 (CEST)", "from pendragon.station (net-37-182-44-227.cust.vodafonedsl.it\n\t[37.182.44.227])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A8EF2D1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Apr 2019 01:12:55 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1556493175;\n\tbh=1CoGRqIoVWa2ucqUqKUbm261ywRQxBorhNA8j5RmAzw=;\n\th=From:To:Subject:Date:From;\n\tb=mlWyKcuzBLRZuMJjj+SdrILqI2L6MTdwYhIvPd04aq1Cw+JnsR57DCB1pJKeJc6Sd\n\tfWCSko9+71jPotYMsuxOnhz4AWDrCWlbimskWQAtfGrelv3iH48PvTvZ6LDqJAUxLP\n\tMSOIy17G0zzjLj6LihOfLE3sOCQtAiGfrJd9ajGE=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 29 Apr 2019 02:12:37 +0300", "Message-Id": "<20190428231238.30547-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: Don't ignore the return\n\tvalue of read() and write()", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Sun, 28 Apr 2019 23:12:57 -0000" }, "content": "The glibc read() and write() functions are defined with the\n__warn_unused_result__ attribute when using FORTIFY_SOURCE. Don't ignore\ntheir return value.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/event_dispatcher_poll.cpp | 8 ++++++--\n test/event.cpp | 13 +++++++++++--\n 2 files changed, 17 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp\nindex 1f0f352a8e0a..2621b7d96b1e 100644\n--- a/src/libcamera/event_dispatcher_poll.cpp\n+++ b/src/libcamera/event_dispatcher_poll.cpp\n@@ -162,7 +162,9 @@ void EventDispatcherPoll::processEvents()\n void EventDispatcherPoll::interrupt()\n {\n \tuint64_t value = 1;\n-\twrite(eventfd_, &value, sizeof(value));\n+\tssize_t ret = write(eventfd_, &value, sizeof(value));\n+\tif (ret < 0)\n+\t\tLOG(Event, Error) << \"Failed to interrupt event dispatcher\";\n }\n \n short EventDispatcherPoll::EventNotifierSetPoll::events() const\n@@ -214,7 +216,9 @@ void EventDispatcherPoll::processInterrupt(const struct pollfd &pfd)\n \t\treturn;\n \n \tuint64_t value;\n-\tread(eventfd_, &value, sizeof(value));\n+\tssize_t ret = read(eventfd_, &value, sizeof(value));\n+\tif (ret < 0)\n+\t\tLOG(Event, Error) << \"Failed to process interrupt\";\n }\n \n void EventDispatcherPoll::processNotifiers(const std::vector<struct pollfd> &pollfds)\ndiff --git a/test/event.cpp b/test/event.cpp\nindex 52bc0c7e77f5..9bd876153a18 100644\n--- a/test/event.cpp\n+++ b/test/event.cpp\n@@ -38,6 +38,7 @@ protected:\n \t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n \t\tstd::string data(\"H2G2\");\n \t\tTimer timeout;\n+\t\tssize_t ret;\n \n \t\tEventNotifier readNotifier(pipefd_[0], EventNotifier::Read);\n \t\treadNotifier.activated.connect(this, &EventTest::readReady);\n@@ -46,7 +47,11 @@ protected:\n \t\tmemset(data_, 0, sizeof(data_));\n \t\tsize_ = 0;\n \n-\t\twrite(pipefd_[1], data.data(), data.size());\n+\t\tret = write(pipefd_[1], data.data(), data.size());\n+\t\tif (ret < 0) {\n+\t\t\tcout << \"Pipe write failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n \n \t\ttimeout.start(100);\n \t\tdispatcher->processEvents();\n@@ -73,7 +78,11 @@ protected:\n \t\tnotified_ = false;\n \t\treadNotifier.setEnabled(false);\n \n-\t\twrite(pipefd_[1], data.data(), data.size());\n+\t\tret = write(pipefd_[1], data.data(), data.size());\n+\t\tif (ret < 0) {\n+\t\t\tcout << \"Pipe write failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n \n \t\ttimeout.start(100);\n \t\tdispatcher->processEvents();\n", "prefixes": [ "libcamera-devel", "1/2" ] }