diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-07-22 23:26:06 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-07-22 23:26:06 +0000 |
commit | 3ddd3e4cda3f10adc23678d9dd195c3205a55e16 (patch) | |
tree | 33997e8fa1048d262a5d79cc62b477ec7bc52e26 | |
parent | 8c96aec54fd28a2c4ab93724eb99e01ee36f944c (diff) |
check argc after getopt(), otherwise we may go ahead even if we only got
flags; from Jean-Francois Brousseau <krapht@secureops.com>.
-rw-r--r-- | usr.bin/pmdb/pmdb.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/pmdb/pmdb.c b/usr.bin/pmdb/pmdb.c index dd53a8256ca..6bb4d758cbe 100644 --- a/usr.bin/pmdb/pmdb.c +++ b/usr.bin/pmdb/pmdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmdb.c,v 1.10 2002/07/22 01:20:50 art Exp $ */ +/* $OpenBSD: pmdb.c,v 1.11 2002/07/22 23:26:05 fgsch Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -97,10 +97,6 @@ main(int argc, char **argv) int level; pid_t pid; - if (argc < 2) { - usage(); - } - core = NULL; pid = 0; @@ -123,6 +119,9 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (argc == 0) + usage(); + if ((pmenv = getenv("IN_PMDB")) != NULL) { level = atoi(pmenv); level++; |