]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
client: fix parsing of -v command option
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Aug 2017 12:08:30 +0000 (14:08 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 9 Aug 2017 07:57:14 +0000 (09:57 +0200)
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

index cfe18a057080d32ce11ea11954e31840142ff5c5..81440705b5e9153c36e5e8254e60b57aa43cc7f8 100644 (file)
--- 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':