summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2016-07-17 17:30:47 +0000
committerotto <otto@openbsd.org>2016-07-17 17:30:47 +0000
commit070edbb260799146cd493880aa7d158c96718c12 (patch)
treeb4ef12fa677dbe2b3500f27a4cd8255b671e2ede
parentstrip back asn1parse; ok beck jsing (diff)
downloadwireguard-openbsd-070edbb260799146cd493880aa7d158c96718c12.tar.xz
wireguard-openbsd-070edbb260799146cd493880aa7d158c96718c12.zip
getopt(3) can be called twice (once for bc and once for dc), so reinit getopt
ok deraadt@
-rw-r--r--usr.bin/dc/dc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/dc/dc.c b/usr.bin/dc/dc.c
index 27afad516d2..38887007669 100644
--- a/usr.bin/dc/dc.c
+++ b/usr.bin/dc/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.17 2015/11/03 04:58:58 mmcc Exp $ */
+/* $OpenBSD: dc.c,v 1.18 2016/07/17 17:30:47 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -50,6 +50,8 @@ dc_main(int argc, char *argv[])
if ((buf = strdup("")) == NULL)
err(1, NULL);
/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
+ optind = 1;
+ optreset = 1;
while ((ch = getopt(argc, argv, "e:x-")) != -1) {
switch (ch) {
case 'e':