Show a patch.

GET /api/patches/24764/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 24764,
    "url": "https://patchwork.libcamera.org/api/patches/24764/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24764/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20251023145906.1088030-1-barnabas.pocze@ideasonboard.com>",
    "date": "2025-10-23T14:59:06",
    "name": "[v1] libcamera: base: {Unique,Shared}FD: Warn if closing fails",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c1b5c9d3f65483445a74713cf07749b77d4b3fc1",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24764/mbox/",
    "series": [
        {
            "id": 5522,
            "url": "https://patchwork.libcamera.org/api/series/5522/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5522",
            "date": "2025-10-23T14:59:06",
            "name": "[v1] libcamera: base: {Unique,Shared}FD: Warn if closing fails",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5522/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24764/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24764/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3EECDBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Oct 2025 14:59:12 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2015607ED;\n\tThu, 23 Oct 2025 16:59:11 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A748607C9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Oct 2025 16:59:09 +0200 (CEST)",
            "from pb-laptop.local (185.221.141.231.nat.pool.zt.hu\n\t[185.221.141.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68FB2591\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Oct 2025 16:57:24 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Ae40GowT\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761231444;\n\tbh=SNpb/UkK5MooaL1bhquKcRlIwiMAGnbUcYlT+TnPVF8=;\n\th=From:To:Subject:Date:From;\n\tb=Ae40GowTRHuY7b3ENzvv4snx8pU/nRpb+mNgU4tNmY49abfuC/6oSkj8oCMPyRctp\n\tk7ZIj+/zvscCA4KGb30XbNPrysX7kES3Opk2aMvQMD729oQ5md13PoR2T654ZhFTk7\n\t6Sy3v2KTqRBYVlX3ldjBR1/a3qT3h6Xq7ssg1JOM=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v1] libcamera: base: {Unique,\n\tShared}FD: Warn if closing fails",
        "Date": "Thu, 23 Oct 2025 16:59:06 +0200",
        "Message-ID": "<20251023145906.1088030-1-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.51.1.dirty",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "If the contained file descriptor cannot be successfully closed,\nthat is usually a sign of a more serious invariant violation,\nwhich deserves attention, so report those cases.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/base/shared_fd.cpp | 7 +++++--\n src/libcamera/base/unique_fd.cpp | 8 ++++++--\n 2 files changed, 11 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/base/shared_fd.cpp b/src/libcamera/base/shared_fd.cpp\nindex 7afc8ca59..81b703a89 100644\n--- a/src/libcamera/base/shared_fd.cpp\n+++ b/src/libcamera/base/shared_fd.cpp\n@@ -284,8 +284,11 @@ SharedFD::Descriptor::Descriptor(int fd, bool duplicate)\n \n SharedFD::Descriptor::~Descriptor()\n {\n-\tif (fd_ != -1)\n-\t\tclose(fd_);\n+\tif (fd_ >= 0 && close(fd_) < 0) {\n+\t\tint ret = -errno;\n+\t\tLOG(SharedFD, Error) << \"Failed to close file descriptor \"\n+\t\t\t\t     << fd_ << \": \" << strerror(-ret);\n+\t}\n }\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/base/unique_fd.cpp b/src/libcamera/base/unique_fd.cpp\nindex d0649e4de..178c08c4b 100644\n--- a/src/libcamera/base/unique_fd.cpp\n+++ b/src/libcamera/base/unique_fd.cpp\n@@ -7,6 +7,7 @@\n \n #include <libcamera/base/unique_fd.h>\n \n+#include <string.h>\n #include <unistd.h>\n #include <utility>\n \n@@ -98,8 +99,11 @@ void UniqueFD::reset(int fd)\n \n \tstd::swap(fd, fd_);\n \n-\tif (fd >= 0)\n-\t\tclose(fd);\n+\tif (fd >= 0 && close(fd) < 0) {\n+\t\tint ret = -errno;\n+\t\tLOG(UniqueFD, Error) << \"Failed to close file descriptor \"\n+\t\t\t\t     << fd << \": \" << strerror(-ret);\n+\t}\n }\n \n /**\n",
    "prefixes": [
        "v1"
    ]
}