[ovs-git] [openvswitch/ovs] d2f441: ovn-nbctl: Detect unrecognized short options in se...

GitHub noreply at github.com
Tue Jul 31 19:35:01 UTC 2018

  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: d2f441997b23dca303f59524a53865497e613620
  Author: Jakub Sitnicki <jkbs at redhat.com>
  Date:   2018-07-31 (Tue, 31 Jul 2018)

  Changed paths:
    M ovn/utilities/ovn-nbctl.c

  Log Message:
  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 at redhat.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>

      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

More information about the git mailing list