docs/129196: Inconsistent errno in strtol()

Stephen Hurd shurd at sasktel.net
Wed Nov 26 00:10:01 UTC 2008


>Number:         129196
>Category:       docs
>Synopsis:       Inconsistent errno in strtol()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 26 00:10:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Hurd
>Release:        7.0-RELEASE
>Organization:
>Environment:
FreeBSD server.hurd.local 7.0-RELEASE FreeBSD 7.0-RELEASE #4: Mon Mar 10 23:00:02 PDT 2008     admin at server.hurd.local:/usr/obj/usr/src/sys/SERVER  i386

>Description:
``strtol("0", NULL, 0);'' and ``strtol("0x", NULL, 0);'' return zero and does not set errno, but ``strtol("", NULL, 0);'' does.  Since the documentation says that an octal value is /0?([0-7]+)/ and a hex value is /(?:0x)?([0-9a-zA-Z])/ in none of the cases can a conversion be performed.

At least SUSv2 states that EINVAL indicates an invalid base argument, not an invalid nptr argument (I don't have the other standards available) so all of those examples should be consistent with each other (most likely not setting errno).
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-doc mailing list