mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Error out with usage line if additional arguments are given after the
option parsing. Found out the hard way by jdixon on ifstated. ok sobrado@, jdixon@, millert@
This commit is contained in:
parent
9daefb46dc
commit
fde55bc4cd
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: isakmpd.c,v 1.96 2007/04/02 08:08:32 moritz Exp $ */
|
||||
/* $OpenBSD: isakmpd.c,v 1.97 2008/05/12 19:15:02 pyr Exp $ */
|
||||
/* $EOM: isakmpd.c,v 1.54 2000/10/05 09:28:22 niklas Exp $ */
|
||||
|
||||
/*
|
||||
@ -234,6 +234,9 @@ parse_args(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if (do_packetlog && !pcap_file)
|
||||
pcap_file = PCAP_FILE_DEFAULT;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bgpd.c,v 1.144 2007/05/11 11:27:59 claudio Exp $ */
|
||||
/* $OpenBSD: bgpd.c,v 1.145 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
@ -169,6 +169,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if (parse_config(conffile, &conf, &mrt_l, &peer_l, &net_l, rules_l)) {
|
||||
free(rules_l);
|
||||
exit(1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dvmrpd.c,v 1.5 2007/10/20 13:26:50 pyr Exp $ */
|
||||
/* $OpenBSD: dvmrpd.c,v 1.6 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -152,6 +152,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
log_init(debug);
|
||||
|
||||
/* multicast IP forwarding must be enabled */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: hostapd.c,v 1.32 2007/05/02 09:09:29 claudio Exp $ */
|
||||
/* $OpenBSD: hostapd.c,v 1.33 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
|
||||
@ -420,6 +420,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if (config == NULL)
|
||||
ret = strlcpy(cfg->c_config, HOSTAPD_CONFIG, sizeof(cfg->c_config));
|
||||
else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: hotplugd.c,v 1.7 2006/05/28 16:44:52 mk Exp $ */
|
||||
/* $OpenBSD: hotplugd.c,v 1.8 2008/05/12 19:15:02 pyr Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
|
||||
*
|
||||
@ -72,6 +72,11 @@ main(int argc, char *argv[])
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if ((devfd = open(device, O_RDONLY)) == -1)
|
||||
err(1, "%s", device);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ifstated.c,v 1.32 2007/11/27 18:50:00 stevesk Exp $ */
|
||||
/* $OpenBSD: ifstated.c,v 1.33 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
|
||||
@ -122,6 +122,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if (opts & IFSD_OPT_NOACTION) {
|
||||
if ((newconf = parse_config(configfile, opts)) == NULL)
|
||||
exit(1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ospf6d.c,v 1.8 2007/12/13 08:54:05 claudio Exp $ */
|
||||
/* $OpenBSD: ospf6d.c,v 1.9 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -169,6 +169,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = PF_INET6;
|
||||
mib[2] = IPPROTO_IPV6;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ospfd.c,v 1.56 2007/10/25 12:06:30 claudio Exp $ */
|
||||
/* $OpenBSD: ospfd.c,v 1.57 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -170,6 +170,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = PF_INET;
|
||||
mib[2] = IPPROTO_IP;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: relayd.c,v 1.74 2008/05/06 09:52:47 pyr Exp $ */
|
||||
/* $OpenBSD: relayd.c,v 1.75 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
|
||||
@ -163,6 +163,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if ((env = parse_config(conffile, opts)) == NULL)
|
||||
exit(1);
|
||||
relayd_env = env;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ripd.c,v 1.8 2007/10/24 20:23:09 claudio Exp $ */
|
||||
/* $OpenBSD: ripd.c,v 1.9 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
|
||||
@ -158,6 +158,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = PF_INET;
|
||||
mib[2] = IPPROTO_IP;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sensorsd.c,v 1.41 2008/03/16 23:54:01 cnst Exp $ */
|
||||
/* $OpenBSD: sensorsd.c,v 1.42 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
|
||||
@ -127,6 +127,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_SENSORS;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: snmpd.c,v 1.6 2008/03/16 00:14:47 dlg Exp $ */
|
||||
/* $OpenBSD: snmpd.c,v 1.7 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
|
||||
@ -134,6 +134,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if ((env = parse_config(conffile, flags)) == NULL)
|
||||
exit(1);
|
||||
snmpd_env = env;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: watchdogd.c,v 1.11 2007/01/02 22:46:37 mbalmer Exp $ */
|
||||
/* $OpenBSD: watchdogd.c,v 1.12 2008/05/12 19:15:02 pyr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Marc Balmer <mbalmer@openbsd.org>
|
||||
@ -86,6 +86,11 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if (interval == 0 && (interval = period / 3) == 0)
|
||||
interval = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user