From 93076e7e1c25dce4214b4e5ae7633ac849e1a12a Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 8 Aug 2017 14:08:30 +0200 Subject: [PATCH] client: fix parsing of -v command option The sources and sourcestats commands accept -v as an option, but the glibc implementation of getopt() reorders the arguments and parses the option as a command-line option of chronyc. Add '+' to the getopt string to disable this feature. Other getopt() implementations should consider it a new command-line option, which will be handled as an error if present. --- client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.c b/client.c index cfe18a0..8144070 100644 --- a/client.c +++ b/client.c @@ -3143,7 +3143,7 @@ main(int argc, char **argv) optind = 1; /* Parse short command-line options */ - while ((opt = getopt(argc, argv, "46acdf:h:mnp:v")) != -1) { + while ((opt = getopt(argc, argv, "+46acdf:h:mnp:v")) != -1) { switch (opt) { case '4': case '6':