BIND 10 #1256: Minor error in getopt() processing

BIND 10 Development do-not-reply at isc.org
Wed Sep 28 10:09:34 UTC 2011


#1256: Minor error in getopt() processing
---------------------------------+-----------------------------------------
            Reporter:  shane     |                        Owner:
                Type:  defect    |                       Status:  new
            Priority:  trivial   |                    Milestone:  New Tasks
           Component:  b10-auth  |                     Keywords:
           Sensitive:  0         |              Defect Severity:  Low
         Sub-Project:  DNS       |  Feature Depending on Ticket:
Estimated Difficulty:  0         |          Add Hours to Ticket:  0
         Total Hours:  0         |                    Internal?:  0
---------------------------------+-----------------------------------------
 According to the getopt() man page:

 {{{
        If getopt() finds an option character in argv that was not included
 in
        optstring,  or  if it detects a missing option argument, it returns
 '?'
        and sets the external variable optopt to the actual  option
 character.
        If  the  first  character  (following any optional '+' or '-'
 described
        above) of optstring is a colon (':'), then getopt() returns ':'
 instead
        of  '?'  to  indicate  a  missing  option  argument.   If  an error
 was
        detected, and the first character of optstring is not a colon, and
 the
        external  variable  opterr  is nonzero (which is the default),
 getopt()
        prints an error message.
 }}}

 We use the leading colon sometimes, I think in an effort to avoid the pre-
 defined error messages, which are ugly and not helpful. However, we then
 check for '?' in our while() loop, which is an error.

 It doesn't actually show up, since we then follow with the default:
 statement, however a restructuring of the code could break this. It's a
 one-line fix.

-- 
Ticket URL: <http://bind10.isc.org/ticket/1256>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list