From patchwork Thu Oct 3 06:35:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Dahl X-Patchwork-Id: 1171089 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lespocky.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rcro96Ew"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46kNYj3lrDz9sN1 for ; Thu, 3 Oct 2019 16:35:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P6dx9AJFuu5opIgc029JQL/ZYlpzkqVyn/O6VthWt0g=; b=rcro96Ew+2RJyy aoZOZhrHKTOam/t/UnQi31KIVxDgGlMtnVJXY7GnJ3B7Ln/LNKcHT4jA2ZR/7IxLwWUzUG5XqIkLS fUuuobxHnzt9cEMM/d9ybxDQWnw1NLL81NlhJhcBNtxf2wkwSAs1eYboFtFyQ7CDfuNIHMlhCkKNY BX+u42klH3HhX5QYp5xiZdlWqWl/JIARIfysH92b0Z9KOcdBoqt3b0pFf0zKRtUD2ySHUuIkc/PJc TRZqNKP4D91y2Sio9y95hi1M/v07X+71SjJp3Xvqs/Lh23vtwv1qnkNdSu8GdUhHIxdG6eZvI2Vh4 gOHDzek6DNifk3Lz/HaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFuiL-0008VZ-Sl; Thu, 03 Oct 2019 06:35:49 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFuiD-0008MR-QX for linux-mtd@lists.infradead.org; Thu, 03 Oct 2019 06:35:43 +0000 Received: from methusalix.home.lespocky.de ([92.117.58.69]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N9Md2-1i1YgE3eQW-015G2O; Thu, 03 Oct 2019 08:35:26 +0200 Received: from lemmy.home.lespocky.de ([192.168.243.176]) by methusalix.home.lespocky.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iFuhw-0002oM-NC; Thu, 03 Oct 2019 08:35:25 +0200 Received: (nullmailer pid 18480 invoked by uid 2001); Thu, 03 Oct 2019 06:35:20 -0000 From: Alexander Dahl To: linux-mtd@lists.infradead.org Subject: [PATCH 1/2] ubihealthd: Add missing sentinel in options array Date: Thu, 3 Oct 2019 08:35:00 +0200 Message-Id: <20191003063501.18421-2-post@lespocky.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191003063501.18421-1-post@lespocky.de> References: <20191003063501.18421-1-post@lespocky.de> MIME-Version: 1.0 X-Scan-Signature: c4845d2fc86daf6cf7a6b32707e363c4 X-Spam-Score: -1.7 (-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LonjoblpBcjctmAbu7KujGgn4oKz8N1fkrVGJKKWavqfyRZ1 7jy+1SLws+WUsD3Vj3iPv4kjzjZzTf+z8a+WpDoTMScx/jNKEpgjRgm9sqx5xGd+wfNoz3S3d o4m8lXgJpSdbUehJHDOXimdoZh3T2J9kmr6cY46Pc= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191002_233542_147500_5B219CFC X-CRM114-Status: UNSURE ( 9.32 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.126.135 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.135 listed in wl.mailspike.net] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Dahl Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org `getopt_long()` requires a null terminated array, otherwise we get segfaults when passing invalid options. Fixes: 7f0e2dc21fb2 ("ubi-utils: Implement a ubihealthd") Signed-off-by: Alexander Dahl --- ubi-utils/ubihealthd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ubi-utils/ubihealthd.c b/ubi-utils/ubihealthd.c index 3e665be..f38235b 100644 --- a/ubi-utils/ubihealthd.c +++ b/ubi-utils/ubihealthd.c @@ -56,6 +56,7 @@ static const struct option options[] = { .flag = NULL, .val = 'i' }, + { /* sentinel */ } }; static void dolog(const char *fmt, ...) From patchwork Thu Oct 3 06:35:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Dahl X-Patchwork-Id: 1171090 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lespocky.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SMdgitUu"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46kNYy0lDtz9sDB for ; Thu, 3 Oct 2019 16:36:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ubgJdqe1zRgsRyzI//AIHGMJcI4VuWMUFKkOr+n2e9E=; b=SMdgitUuyFPWYk SRvJ0izm9V9a1JQusNkpw8n7SJM0ZW7N6+F9d99CEAWSAybo3jCCrk7zjZI6mP149Sd3/dgbIvk4y 0dp+iLlbMP4omW/wXkE4SU35k5vaLB0UNh1vaU6qizUvC/hYekCXnSl44hVjYQnvX2F/0WqfWq4WO CePAAFsRNDOEez/CNvkBKErvlXTe/Ue9m+E/vurI49KFMJF7ueHqewMSj4/SgqrcPxlMD6G5kqSJ/ rvbZj87/YPn5gfLQ4Jmrc9EF7wRr24F2Q6auS+7Psd1I8XMUOgACMbmjS8JbnFo7xuegWYF4zZoB4 q45FHAMusdTu+I9UiWOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFuiX-0000Jf-MB; Thu, 03 Oct 2019 06:36:01 +0000 Received: from mout.kundenserver.de ([217.72.192.73]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFuiE-0008Ma-V8 for linux-mtd@lists.infradead.org; Thu, 03 Oct 2019 06:35:44 +0000 Received: from methusalix.home.lespocky.de ([92.117.58.69]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M7s1M-1iC2pQ1gxe-0051Ln; Thu, 03 Oct 2019 08:35:26 +0200 Received: from lemmy.home.lespocky.de ([192.168.243.176]) by methusalix.home.lespocky.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iFuhv-0002o9-4q; Thu, 03 Oct 2019 08:35:24 +0200 Received: (nullmailer pid 18482 invoked by uid 2001); Thu, 03 Oct 2019 06:35:20 -0000 From: Alexander Dahl To: linux-mtd@lists.infradead.org Subject: [PATCH 2/2] ubihealthd: Add option -h/--help Date: Thu, 3 Oct 2019 08:35:01 +0200 Message-Id: <20191003063501.18421-3-post@lespocky.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191003063501.18421-1-post@lespocky.de> References: <20191003063501.18421-1-post@lespocky.de> MIME-Version: 1.0 X-Scan-Signature: 47e1ccf8997e9864e874f9390d09bff5 X-Spam-Score: -1.8 (-) X-Provags-ID: V03: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MByUd8T6aNZ3MGQ55S9ju0n9KRi+IlQGSGmoXk /2ll1S8T504mEPLc0u3D6WK6iaPnyOHfWmpDQKUxEXRUHgXLTXG+j/YwrCqL0edf5sksqj5gf S8xfGrkGRl+3+gAbU13N8UE+GEXo76mvMKl8H68kY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191002_233543_291996_6D1FCBC3 X-CRM114-Status: GOOD ( 14.04 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [217.72.192.73 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.72.192.73 listed in wl.mailspike.net] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Dahl Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Using '?' as option did not work, and would be strange to pass anyway, because it's a glob char for the shell and you would have to escape it like ./ubihealthd -\? … use the more common -h/--help instead. Note: this does not touch the output, just changes the options itself. Signed-off-by: Alexander Dahl --- ubi-utils/ubihealthd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ubi-utils/ubihealthd.c b/ubi-utils/ubihealthd.c index f38235b..27799f7 100644 --- a/ubi-utils/ubihealthd.c +++ b/ubi-utils/ubihealthd.c @@ -42,7 +42,7 @@ static int ubi_fd; static int interval_secs = 120; static int nodaemon; -static const char opt_string[] = "d:i:f"; +static const char opt_string[] = "d:i:fh"; static const struct option options[] = { { .name = "device", @@ -56,6 +56,12 @@ static const struct option options[] = { .flag = NULL, .val = 'i' }, + { + .name = "help", + .has_arg = no_argument, + .flag = NULL, + .val = 'h' + }, { /* sentinel */ } }; @@ -238,7 +244,7 @@ int main (int argc, char *argv[]) nodaemon = 1; break; } - case '?': + case 'h': default: fprintf(stderr, "Usage: %s [ -d UBI_DEVICE ] [-i INTERVAL_SEC ] [ -f ]\n", argv[0]); exit(1);