]> git.proxmox.com Git - ovs.git/commit
ovn-nbctl: Detect unrecognized short options in server mode.
authorJakub Sitnicki <jkbs@redhat.com>
Wed, 25 Jul 2018 15:26:54 +0000 (17:26 +0200)
committerBen Pfaff <blp@ovn.org>
Tue, 31 Jul 2018 19:35:16 +0000 (12:35 -0700)
commit7f256dc110b43f3caf54f7a3b3f345b37bb2d086
tree99c417c1b1b6732a319fd7606e656af5c5de8e1e
parent7cf6f4d52ebf11a740e7955e4b0bce6d04b963c4
ovn-nbctl: Detect unrecognized short options in server mode.

Because getopt() will set optopt for both known and unknown options,
we need to differentiate between them ourselves by checking if we
know the option. Do that by looking up its value.

Also, because we are using GNU extensions to getopt(), we need to be
resetting getopt() state by setting optind to 0 instead of 1 as
pointed out in NOTES in getopt(3) man-page. Not doing so results in
invalid reads and optopt being set to a garbarge value.

Fixes: 3ec06ea9c668 ("ovn-nbctl: Initial support for daemon mode.")
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovn/utilities/ovn-nbctl.c