summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-08-03 00:23:15 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-08-03 00:23:15 +0000
commita664d03bc76eacc0521af20ee85492b1d6d8a66e (patch)
treee0577eccc83626d8b625192e9501364a6ac4a51e
parent2d6c73c55745fd2113b0c1f480ea0ed24095b184 (diff)
dmesg(8): don't accept positional arguments
dmesg(8) doesn't use any positional arguments. If we see any, it's a usage error. ok florian@, "Sure" deraadt@ millert@
-rw-r--r--sbin/dmesg/dmesg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index 4d63370e9ab..1b4ef99e5b9 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dmesg.c,v 1.31 2019/12/24 13:20:44 bluhm Exp $ */
+/* $OpenBSD: dmesg.c,v 1.32 2022/08/03 00:23:14 cheloha Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
@@ -89,6 +89,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (argc != 0)
+ usage();
+
if (memf == NULL && nlistf == NULL) {
int mib[2], msgbufsize;
size_t len;