summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/arguments.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-03-17 16:02:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-03-17 16:02:39 +0000
commit2699e974912b10fd8277dc7b0916a4c7e8a5734b (patch)
tree8f803f485f41e0a6d5cbf07dc816a5ba31b0c37c /usr.bin/tmux/arguments.c
parent508ec350ed27bbd66857fdbe4ded78d6808de765 (diff)
getopt is not required to set optarg to NULL when there is no argument
and some do not, so set it explicitly each time.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-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;