Show a patch.

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

{
    "id": 18381,
    "url": "https://patchwork.libcamera.org/api/patches/18381/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18381/",
    "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": "<20230312212205.44168-1-mail@eliasnaur.com>",
    "date": "2023-03-12T21:22:05",
    "name": "[libcamera-devel,v2] libcamera: v4l2_device: openat(2) with O_CLOEXEC to cleanup after exec(3)",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "783510309fb0c67f0bbc16a4af911c9b430ff652",
    "submitter": {
        "id": 159,
        "url": "https://patchwork.libcamera.org/api/people/159/?format=api",
        "name": "Elias Naur",
        "email": "mail@eliasnaur.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18381/mbox/",
    "series": [
        {
            "id": 3801,
            "url": "https://patchwork.libcamera.org/api/series/3801/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3801",
            "date": "2023-03-12T21:22:05",
            "name": "[libcamera-devel,v2] libcamera: v4l2_device: openat(2) with O_CLOEXEC to cleanup after exec(3)",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3801/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18381/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18381/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 680BBBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 12 Mar 2023 21:22:28 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A31A262709;\n\tSun, 12 Mar 2023 22:22:27 +0100 (CET)",
            "from mail-ua1-x935.google.com (mail-ua1-x935.google.com\n\t[IPv6:2607:f8b0:4864:20::935])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 65F6762705\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Mar 2023 22:22:26 +0100 (CET)",
            "by mail-ua1-x935.google.com with SMTP id 89so160212uao.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Mar 2023 14:22:26 -0700 (PDT)",
            "from localhost.localdomain ([190.53.0.133])\n\tby smtp.gmail.com with ESMTPSA id\n\tw143-20020a1fad95000000b003bd94c3a733sm909594vke.0.2023.03.12.14.22.23\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 12 Mar 2023 14:22:24 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678656147;\n\tbh=4WxkpYPtetm9YgRs928jTWgIkeXtHrfo82XwUTZVtso=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=QCzKZKs7qY4JWc6KIpfqyQ0yHmZPNp2CALBl82wl3bERdhKh8CFEWlBfY0gUKnoXG\n\t8A95yhAGluX9ZbeXHPHQ/VekgsNPTOWtPj+3yKO+2u96zLTrQ38RvET5KO/9MgNyRn\n\t6AozXz5m6cB7rZwiHfVFyV4IMUyefK2z+4EV0f5/1xn4skMPGRPSoOo8LfcdrQFEz0\n\tfMaYqoNGx4Fh09LmaO0cTU9oCoXfQjeFWuQpN6kBnwihH5Jkjt7dk0q4wbAUAm6cxo\n\tOxTT8cJTcsX78xjqxr8hPNgeYLDxeWDGj+SPvZpn0YwIDJNM53TMBXKL8etv7I5aF4\n\tgsTrV/AOgUzsA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=eliasnaur.com; s=google; t=1678656145;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=hHk7FH35GQEzC75IuaVuRQmjLtjMeQoLbiO0819cHME=;\n\tb=e86OH/5oKAqhc4vkoiq8tclkmMdAiWn1cqw2ymrTtXXG3rebplq9kRwNP//yHAIy+B\n\t8dh/5EGhLob4cNxesA5Vg4i8rV7EeyHeAYwIXPoaTNIQIdwuRO1QIeyc7+iL5M0N8j81\n\tY1rH+8iwx4cX7HrSpHNFkiiHvocR8iFHabD3AKcKGRGyVfHv9WUMt5Hsb1h6jC0+WAVn\n\tMTbaLrIlkuaIJbhS/gwWS4qqyF5bnwXHfvdo5dFyr+Ze/GNdrz7GT/kCfSJRmtPaQ8Js\n\tAZI+nJXDMc5+cwk9/+zLvrw7CJBkaxZulU9H2cgj9vYS57y2tEsjMzmnxPHmqlDe8tLy\n\tYrjA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=eliasnaur.com\n\theader.i=@eliasnaur.com\n\theader.b=\"e86OH/5o\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1678656145;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=hHk7FH35GQEzC75IuaVuRQmjLtjMeQoLbiO0819cHME=;\n\tb=26NJKVVXReBsLuFk/ImlOJdfbOtNtIw18qCLbBDJc6s5RxkOKcoKdGaU6CZIOdqD3x\n\t2VHL80Ja1E6IdDQ6UV3RJRz4gEF6cOAzCWQWWoZpHNPueuXmKC35WIut1LtAVjKXpTc9\n\tx9EJkWbD6PLwN6Xg28orVXPGEd6uhAX5Al9S3RG8wAsttGqleTNA0XPfD1u/RjoM/UPE\n\t3nJwOepCE11s1/9+wv4n/qXLnPmbsx8oOXigsY8R8BK2fBBAuvhvd0QBZsSA85LiSY25\n\tijGmWt2YHLWNRxey1hFQWsbjGpTQKFnE1X8hsOLlbpe4k3xaIXVAPe7E6a8f1fs0mukp\n\thMyQ==",
        "X-Gm-Message-State": "AO0yUKXX2be3T5YBqxZM8qJOtNqzs0z9HXKaGm4ufoeBIFBGw+suRM//\n\t1PzZJwcuaxFLsjzKHqSyqK5378CNHXrQOWXsHcA=",
        "X-Google-Smtp-Source": "AK7set/RyAr1x0vAhgBnMOutSE5BJaTW6fVc36UgB1wEgov3oZ1DCBOWyzWO5PaliBoxkA9a3/2LJg==",
        "X-Received": "by 2002:a1f:2790:0:b0:431:fa2d:402f with SMTP id\n\tn138-20020a1f2790000000b00431fa2d402fmr263476vkn.15.1678656144958; \n\tSun, 12 Mar 2023 14:22:24 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 12 Mar 2023 15:22:05 -0600",
        "Message-Id": "<20230312212205.44168-1-mail@eliasnaur.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: v4l2_device: openat(2) with\n\tO_CLOEXEC to cleanup after exec(3)",
        "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>",
        "From": "Elias Naur via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Elias Naur <mail@eliasnaur.com>",
        "Cc": "Elias Naur <mail@eliasnaur.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "It's generally a good idea to openat(2) with O_CLOEXEC, but this patch\nalso fixes a real (corner-)case: I have an excutable that (1) uses\nv4l2-compat to drive a RPi camera, (2) self-updates through exec(3).\nWithout O_CLOEXEC of the kernel devices, an update while the\ncamera is opened will result in -EBUSY errors when the update tries to\nopen the camera.\n\nSigned-off-by: Elias Naur <mail@eliasnaur.com>\n---\n\nThis update fixes a style issue raised through review and clarifies the\n motivatition for the fix.\n\n src/libcamera/v4l2_device.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)",
    "diff": "diff --git src/libcamera/v4l2_device.cpp src/libcamera/v4l2_device.cpp\nindex 57a88d96..9eb26839 100644\n--- src/libcamera/v4l2_device.cpp\n+++ src/libcamera/v4l2_device.cpp\n@@ -86,7 +86,7 @@ int V4L2Device::open(unsigned int flags)\n \t\treturn -EBUSY;\n \t}\n \n-\tUniqueFD fd(syscall(SYS_openat, AT_FDCWD, deviceNode_.c_str(), flags));\n+\tUniqueFD fd(syscall(SYS_openat, AT_FDCWD, deviceNode_.c_str(), flags | O_CLOEXEC));\n \tif (!fd.isValid()) {\n \t\tint ret = -errno;\n \t\tLOG(V4L2, Error) << \"Failed to open V4L2 device '\"\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}