Patch Detail
Show a patch.
GET /api/1.1/patches/9566/?format=api
{ "id": 9566, "url": "https://patchwork.libcamera.org/api/1.1/patches/9566/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9566/", "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": "<20200910041459.17110-1-laurent.pinchart@ideasonboard.com>", "date": "2020-09-10T04:14:59", "name": "[libcamera-devel] android: jpeg: exif: Use reentrant localtime_r()", "commit_ref": "7720c4aefa95ee9df6e5d464c187efa7141f1302", "pull_url": null, "state": "accepted", "archived": false, "hash": "7f7cb0b470a35b502d4112872bf13c7ba65009d8", "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/9566/mbox/", "series": [ { "id": 1283, "url": "https://patchwork.libcamera.org/api/1.1/series/1283/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1283", "date": "2020-09-10T04:14:59", "name": "[libcamera-devel] android: jpeg: exif: Use reentrant localtime_r()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1283/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9566/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9566/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 304FEBDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Sep 2020 04:15:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B6C1762D04;\n\tThu, 10 Sep 2020 06:15:32 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 39FA962B90\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Sep 2020 06:15:31 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AAC7739;\n\tThu, 10 Sep 2020 06:15:30 +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=\"nBGzonrL\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1599711330;\n\tbh=P7YQUOjIi0+EItlJhsjhnZkHqt0uuWUU1z9OYnQ9jZ8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=nBGzonrLNZGGnHUMWkUkkjzu41gFpU3O7UbtE87Ot3O20y3bBzWjVLo0UXcmrm825\n\tgkJHpw0WYkEaOj3AgjShg18heF5M2JfucAiEaf/TNTnwV698gJVTQ6w9d6n5bUgMgv\n\tHH3vM9ghKkq2Ci2zTGQE4fx+YPc6qEA8oDiCHCQM=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 10 Sep 2020 07:14:59 +0300", "Message-Id": "<20200910041459.17110-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] android: jpeg: exif: Use reentrant\n\tlocaltime_r()", "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=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The std::localtime() function isn't thread-safe, and we have no\nguarantee whether other threads in the camera service may or may not\ncall it. Replace it with localtime_r(). This requires switching from\nctime to time.h, as there is no std::localtime_r() function.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/jpeg/exif.cpp | 6 ++++--\n src/android/jpeg/exif.h | 2 +-\n 2 files changed, 5 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\nindex 1ced55343ee9..c0dbfcc216b9 100644\n--- a/src/android/jpeg/exif.cpp\n+++ b/src/android/jpeg/exif.cpp\n@@ -186,9 +186,11 @@ void Exif::setSize(const Size &size)\n \n void Exif::setTimestamp(time_t timestamp)\n {\n+\tstruct tm tm;\n+\tlocaltime_r(×tamp, &tm);\n+\n \tchar str[20];\n-\tstd::strftime(str, sizeof(str), \"%Y:%m:%d %H:%M:%S\",\n-\t\t std::localtime(×tamp));\n+\tstrftime(str, sizeof(str), \"%Y:%m:%d %H:%M:%S\", &tm);\n \tstd::string ts(str);\n \n \tsetString(EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, ts);\ndiff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h\nindex 622de4cfd593..f04cefcea74a 100644\n--- a/src/android/jpeg/exif.h\n+++ b/src/android/jpeg/exif.h\n@@ -7,8 +7,8 @@\n #ifndef __ANDROID_JPEG_EXIF_H__\n #define __ANDROID_JPEG_EXIF_H__\n \n-#include <ctime>\n #include <string>\n+#include <time.h>\n \n #include <libexif/exif-data.h>\n \n", "prefixes": [ "libcamera-devel" ] }