Patch Detail
Show a patch.
GET /api/1.1/patches/8774/?format=api
{ "id": 8774, "url": "https://patchwork.libcamera.org/api/1.1/patches/8774/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8774/", "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": "<20200714090936.9562-4-laurent.pinchart@ideasonboard.com>", "date": "2020-07-14T09:09:36", "name": "[libcamera-devel,v2,4/4] libcamera: file: Create the file on open() if it doesn't exist", "commit_ref": "c1bbba36d39e60388d6e9e13418dedb08114f9b2", "pull_url": null, "state": "accepted", "archived": false, "hash": "2ab703fdc607bc3fa7d73ce07908495a0b9b88a1", "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/8774/mbox/", "series": [ { "id": 1103, "url": "https://patchwork.libcamera.org/api/1.1/series/1103/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1103", "date": "2020-07-14T09:09:33", "name": "[libcamera-devel,v2,1/4] libcamera: file: Add read/write support", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1103/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8774/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8774/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 E73EFBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2020 09:09:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AAB696081A;\n\tTue, 14 Jul 2020 11:09:49 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6C30607BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 11:09:47 +0200 (CEST)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 93DF671D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 11:09:47 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Kq8j6yyH\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594717787;\n\tbh=HvbYpu1YRVVxXvEgooF8Tm0ef3WHzKwJTs2u3t7qwUI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Kq8j6yyHzDWwFCWj5lb1rlGVOTx+1VsXe+Np/ZOyGNmRSS26XZ7qC53GyoDwYnQfj\n\teszIeKZ1RXqAjGX0j1Ti+o1kmpgTrD7CfnNbk5s+nngsEiCXy+IqsWtLoJgGy53m/h\n\t/5lkzqfCQ2CuEHIItHFb6YFRspImlqfnGMCePGVw=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 14 Jul 2020 12:09:36 +0300", "Message-Id": "<20200714090936.9562-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200714090936.9562-1-laurent.pinchart@ideasonboard.com>", "References": "<20200714090936.9562-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 4/4] libcamera: file: Create the file\n\ton open() if it doesn't exist", "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>", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "When a file is opened in WriteOnly or ReadWrite mode, create it if it\ndoesn't exist.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/file.cpp | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/file.cpp b/src/libcamera/file.cpp\nindex d99a1806e1c8..04b0cb61a1bf 100644\n--- a/src/libcamera/file.cpp\n+++ b/src/libcamera/file.cpp\n@@ -148,8 +148,9 @@ bool File::exists() const\n * \\param[in] mode The open mode\n *\n * This function opens the file specified by fileName() in \\a mode. If the file\n- * doesn't exist and the mode is WriteOnly or ReadWrite, this\n- * function will attempt to create the file.\n+ * doesn't exist and the mode is WriteOnly or ReadWrite, this function will\n+ * attempt to create the file with initial permissions set to 0666 (modified by\n+ * the process' umask).\n *\n * The error() status is updated.\n *\n@@ -163,8 +164,10 @@ bool File::open(File::OpenMode mode)\n \t}\n \n \tint flags = (mode & ReadWrite) - 1;\n+\tif (mode & WriteOnly)\n+\t\tflags |= O_CREAT;\n \n-\tfd_ = ::open(name_.c_str(), flags);\n+\tfd_ = ::open(name_.c_str(), flags, 0666);\n \tif (fd_ < 0) {\n \t\terror_ = -errno;\n \t\treturn false;\n", "prefixes": [ "libcamera-devel", "v2", "4/4" ] }