From: Miroslav Lichvar Date: Tue, 8 Aug 2017 12:08:30 +0000 (+0200) Subject: client: fix parsing of -v command option X-Git-Tag: 3.2-pre2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93076e7e1c25dce4214b4e5ae7633ac849e1a12a;p=thirdparty%2Fchrony.git 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. --- diff --git a/client.c b/client.c index cfe18a05..81440705 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':