{"id":1336,"url":"https://patchwork.libcamera.org/api/1.1/patches/1336/?format=json","web_url":"https://patchwork.libcamera.org/patch/1336/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190603015749.1311-1-eamanu@eamanu.com>","date":"2019-06-03T01:57:49","name":"[libcamera-devel] Avoid Segmentation Fault when use --help parameter","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"48a97a6df936313968d99a3eeabc7d202f2e874d","submitter":{"id":18,"url":"https://patchwork.libcamera.org/api/1.1/people/18/?format=json","name":"Emmanuel Arias","email":"eamanu@eamanu.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1336/mbox/","series":[{"id":334,"url":"https://patchwork.libcamera.org/api/1.1/series/334/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=334","date":"2019-06-03T01:57:49","name":"[libcamera-devel] Avoid Segmentation Fault when use --help parameter","version":1,"mbox":"https://patchwork.libcamera.org/series/334/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1336/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1336/checks/","tags":{},"headers":{"Return-Path":"<eamanu@eamanu.com>","Received":["from dtc-mta-104-233.dattaweb.com (dtc-mta-104-233.dattaweb.com\n\t[200.58.104.233])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F30E660C2A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Jun 2019 03:58:10 +0200 (CEST)","from c054-dr.dattaweb.com (c054.linux.backend [172.17.110.63])\n\tby smarthost02.dattaweb.com (Postfix) with ESMTPS id 832324C1D0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  2 Jun 2019 22:58:08 -0300 (-03)","from [181.92.78.23] (helo=localhost.localdomain)\n\tby c054-dr.dattaweb.com with esmtpsa\n\t(TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)\n\t(Exim 4.92) (envelope-from <eamanu@eamanu.com>)\n\tid 1hXcEg-0008By-W3; Sun, 02 Jun 2019 22:58:08 -0300"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=eamanu.com;\n\ts=mail;\n\th=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:\n\tContent-Type:Content-Transfer-Encoding:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tIn-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=pVFLB8sl3SVDcRKaAoTfwRVYZCqeRq0jbbjgOZD1QzI=;\n\tb=l+fEbb2Jo4HQOVAMpEKy7Yg4IU\n\tqrxbtwLcaGX3Uo3M4Vug6uea7x7NK7ZoiKQ/SyvLAh30I/WMw/9ISdMcHuLtXMRzfXULVct/cR+eC\n\tOCD2+MPvXWRS0Nw8CLwzDeMCbu6uXzIxoQBGXvlpACsf7gy6GEt1AEbT/8rKoQvbLueQ=;","From":"Emmanuel Arias <eamanu@eamanu.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  2 Jun 2019 22:57:49 -0300","Message-Id":"<20190603015749.1311-1-eamanu@eamanu.com>","X-Mailer":"git-send-email 2.11.0","X-Spam-Score":"0.9","X-Spam-Score-Int":"9","X-Spam-Bar":"/","X-Spam-Report":"Action: no action Symbol: ARC_NA(0.00)\n\tSymbol: RCVD_VIA_SMTP_AUTH(0.00) Symbol: FROM_HAS_DN(0.00)\n\tSymbol: TO_MATCH_ENVRCPT_ALL(0.00) Symbol: MIME_GOOD(-0.10)\n\tSymbol: TO_DN_NONE(0.00) Symbol: RCPT_COUNT_TWO(0.00)\n\tSymbol: MID_CONTAINS_FROM(1.00) Symbol: RCVD_COUNT_ONE(0.00)\n\tSymbol: FROM_EQ_ENVFROM(0.00) Symbol: MIME_TRACE(0.00)\n\tSymbol: ASN(0.00) Symbol: RCVD_TLS_ALL(0.00)\n\tMessage-ID: 20190603015749.1311-1-eamanu@eamanu.com","X-AntiAbuse":["This header was added to track abuse,\n\tplease include it with any abuse report","Primary Hostname - c054-dr.dattaweb.com","Original Domain - lists.libcamera.org","Originator/Caller UID/GID - [502 502] / [502 502]","Sender Address Domain - eamanu.com"],"Subject":"[libcamera-devel] [PATCH] Avoid Segmentation Fault when use --help\n\tparameter","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":"Mon, 03 Jun 2019 01:58:11 -0000"},"content":"When Cam::parseOptions receive help args return -EINTR and\nCam::init return 0 to main. But the first if does not return EXIT_FAILURE\nand continue. That launch a SegFaults\n---\n src/cam/main.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex dbf0491..d23390a 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -61,7 +61,7 @@ int CamApp::init(int argc, char **argv)\n \n \tret = parseOptions(argc, argv);\n \tif (ret < 0)\n-\t\treturn ret == -EINTR ? 0 : ret;\n+\t\treturn ret == -EINTR ? -EINTR : ret;\n \n \tcm_ = CameraManager::instance();\n \n@@ -196,7 +196,7 @@ int main(int argc, char **argv)\n \n \tif (app.init(argc, argv))\n \t\treturn EXIT_FAILURE;\n-\n+\t\n \tstruct sigaction sa = {};\n \tsa.sa_handler = &signalHandler;\n \tsigaction(SIGINT, &sa, nullptr);\n","prefixes":["libcamera-devel"]}