summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-03-17 16:02:38 +0000
committernicm <nicm@openbsd.org>2020-03-17 16:02:38 +0000
commit08ce1db4fbd76f19795c7f90914aeb042cb5003f (patch)
tree1f112617df57159c4c936a04bf87586c894d6f9c
parentHook this up to the drm(4) panel code and add an override for the (diff)
downloadwireguard-openbsd-08ce1db4fbd76f19795c7f90914aeb042cb5003f.tar.xz
wireguard-openbsd-08ce1db4fbd76f19795c7f90914aeb042cb5003f.zip
getopt is not required to set optarg to NULL when there is no argument
and some do not, so set it explicitly each time.
-rw-r--r--usr.bin/tmux/arguments.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index ffd3f8c5025..9dcf7cbceb2 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.27 2019/07/09 14:03:12 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.28 2020/03/17 16:02:38 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -75,6 +75,7 @@ args_parse(const char *template, int argc, char **argv)
optreset = 1;
optind = 1;
+ optarg = NULL;
while ((opt = getopt(argc, argv, template)) != -1) {
if (opt < 0)
@@ -84,6 +85,7 @@ args_parse(const char *template, int argc, char **argv)
return (NULL);
}
args_set(args, opt, optarg);
+ optarg = NULL;
}
argc -= optind;
argv += optind;