From nobody Wed Oct 12 14:30:37 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MnZnT2fzXz4fT72; Wed, 12 Oct 2022 14:30:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MnZnT2B0Kz45xC; Wed, 12 Oct 2022 14:30:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665585037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4lchc/xGPPcm7M9y77s+QmmuVMx8QZMmFW3CNIT8na4=; b=ePMbubVDYUpp5Qkd0rggxLJ8URsUvybOz/Vf7r3YaV3KMJrxjM5oLbZxFC7T2vKtVVvLwG nhX+zptHjqI4HSBnoFd1V07lGN89qJPXWJBLij/Mte4I0hlXUgfUmqiXB7Mr1pHFtQX0N9 e99uLS3Fe4A8ExmUpZ8CeDw9ezrweQLv170SRc2Nzim5dJhD6go5jHEl0DIe53rAOFSJiQ vS94XlPtreNTaZ8wD5EkVOl+txRJGH/Yf7cUDilmhZJrFH0M6danyeRtesck4ouA07PhRg 0bw1NYmA4s5caneRvWEiwZKK9yQqxFt7xrG6O8ScoGIlhCiflGqs1pYOS66F3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MnZnT1Dhhz1LBG; Wed, 12 Oct 2022 14:30:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29CEUbh1041385; Wed, 12 Oct 2022 14:30:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29CEUbZk041384; Wed, 12 Oct 2022 14:30:37 GMT (envelope-from git) Date: Wed, 12 Oct 2022 14:30:37 GMT Message-Id: <202210121430.29CEUbZk041384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 45c11d540199 - main - blacklistd: Fix usage for blacklistd/blacklistctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45c11d5401996f51a05b92e0ef238d225989b5ca Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665585037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4lchc/xGPPcm7M9y77s+QmmuVMx8QZMmFW3CNIT8na4=; b=Es2CiAxnC+qJ0k1XBxW5FMagD736TkPYyUyrAEl0zFILL2lIaQokm8czggoyG48rlD0xbj scgN1RRMJ5w8QbVXrL48JBVwhetJDf/t+LEBb4lzPQzLrQk4bNeeBY7RtDLzXV9+5J2lya qXvX4CqpTGf/vNupI6PpTng68A/rRHxOueFu792u6aZ+csj/+uAkyrJ4lJnHh5BV/Vqa2E HZyLtRGaj0c7sK+f20/FdtXXEEQtX+30iB5KRdvVk5aqM0rXkVKKpuxZMN3RVx2k5tF4Ul Bv0A7axbhmvAoJdwZcwKaqy6/of6zetWMrikTOaSMUIVedEgpDtXrON2Yqzf0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665585037; a=rsa-sha256; cv=none; b=ArWkcLUgEJtELsHqlKH8nzFT3INQ9GUYVJxpHpitRAy0bEmVztCXyWoKDbNJWYW2l3v9jS XqQ6sd3uskjCIlhfQRg59fZjfLuQoCIa/nyJMtBmv6Lh4dRtEzXOCwHwINcgeLInSsT9Ri 7SAKcB8OuR/vfvktwAQaMfbKxARi//M8vpnYMyFbV6Y8BYKW8wGUeLSxJ1KUW/hNgJgLvd Q7LRJeSh37vrxjrkAeRypAdmrjvRJ69Xx4LSJVsc+noNo8IAwpWnNE5POyPf2tksqvkVot E360E6cPUo5D5JmdqxL+9GGW8rSs5TymTt3EjhHvtSoJudAiwUVJU42CLE5QxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=45c11d5401996f51a05b92e0ef238d225989b5ca commit 45c11d5401996f51a05b92e0ef238d225989b5ca Author: Jose Luis Duran AuthorDate: 2022-10-12 13:28:43 +0000 Commit: Ed Maste CommitDate: 2022-10-12 14:30:12 +0000 blacklistd: Fix usage for blacklistd/blacklistctl If getopt(3) encounters a character not found in optstring or if it detects a missing option argument, it returns ? (question mark). Obtained from: https://github.com/zoulasc/blocklist Differential Revision: https://reviews.freebsd.org/D36087 --- contrib/blacklist/bin/blacklistctl.c | 3 +-- contrib/blacklist/bin/blacklistd.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/blacklist/bin/blacklistctl.c b/contrib/blacklist/bin/blacklistctl.c index aebbf72acc5e..89b72921caf5 100644 --- a/contrib/blacklist/bin/blacklistctl.c +++ b/contrib/blacklist/bin/blacklistctl.c @@ -61,7 +61,7 @@ usage(int c) { if (c == 0) warnx("Missing/unknown command"); - else + else if (c != '?') warnx("Unknown option `%c'", (char)c); fprintf(stderr, "Usage: %s dump [-abdnrw]\n", getprogname()); exit(EXIT_FAILURE); @@ -123,7 +123,6 @@ main(int argc, char *argv[]) break; default: usage(o); - break; } db = state_open(dbname, O_RDONLY, 0); diff --git a/contrib/blacklist/bin/blacklistd.c b/contrib/blacklist/bin/blacklistd.c index e880eb457df0..11c73451b84e 100644 --- a/contrib/blacklist/bin/blacklistd.c +++ b/contrib/blacklist/bin/blacklistd.c @@ -105,7 +105,7 @@ sigdone(int n __unused) static __dead void usage(int c) { - if (c) + if (c != '?') warnx("Unknown option `%c'", (char)c); fprintf(stderr, "Usage: %s [-vdfr] [-c ] [-R ] " "[-P ] [-C ] [-D ] " @@ -480,7 +480,7 @@ main(int argc, char *argv[]) argc -= optind; if (argc) - usage(0); + usage('?'); signal(SIGHUP, sighup); signal(SIGINT, sigdone);