Issue393

Title confstr() should return 0, not -1, on errors
Priority bug Status resolved
Superseder Nosy List TGEN, guy
Assigned To TGEN Keywords

Created on 2006-12-02.23:03:04 by guy, last changed by TGEN.

Files
File name Uploaded Type Edit Remove
confstr.diff TGEN, 2006-12-05.19:29:01 text/x-patch
getconf.diff TGEN, 2006-12-05.22:28:00 text/x-patch
Messages
msg1701 (view) Author: TGEN Date: 2006-12-06.12:01:47
Patches have been committed.
msg1700 (view) Author: TGEN Date: 2006-12-05.22:28:00
And the next attached patch fixes the only consumer of confstr(3) in our 
tree (something the other BSDs don't appear to have done).

Cheers,
-- 
         Thomas E. Spanjaard
         tgen@netphreax.net
msg1698 (view) Author: TGEN Date: 2006-12-05.19:29:01
See attached patch.

Cheers,
-- 
         Thomas E. Spanjaard
         tgen@netphreax.net
msg1696 (view) Author: dillon Date: 2006-12-04.20:23:00
:Not with top-of-tree FreeBSD, it isn't - the top-of-tree FreeBSD code 
:returns 0:
:
:http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/confstr.c?rev=1.9&content-type=text/x-cvsweb-markup
:...

    Seems pretty conclusive to me.  Would someone like to make this
    adjustment in our tree?

					-Matt
msg1695 (view) Author: guy Date: 2006-12-04.19:19:02
Not with top-of-tree FreeBSD, it isn't - the top-of-tree FreeBSD code 
returns 0:

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/confstr.c?rev=1.9&content-type=text/x-cvsweb-markup

The documentation, until recently, said it returned -1, but I filed a 
bug about that:

    http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/106234

and it was recently fixed:

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/confstr.3.diff?r1=1.13&r2=1.14

As for NetBSD, I filed a bug on the code:

    http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=35170

which is now closed - they changed the code and the man page.

Similar changes were made to OpenBSD in response to bug mail I sent:

http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/confstr.c.diff?r1=1.7&r2=1.8

http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/confstr.3.diff?r1=1.14&r2=1.15

so DragonFly is now inconsistent with the top of the tree of FreeBSD, 
NetBSD, and OpenBSD, and its code is inconsistent with the 5.x and 6.x 
releases of FreeBSD.
> I don't have
> a reference to POSIX.2 to verify the original specification.
>   
Perhaps POSIX.2 said it returned -1 (I think my POSIX.2 is at work), but 
what counts now is the Single UNIX Specification, and, as per the URL I 
think I sent in my mail:

    http://www.opengroup.org/onlinepubs/009695399/functions/confstr.html

it says it returns 0 on errors.
msg1694 (view) Author: joerg Date: 2006-12-04.11:15:01
It should be noted that this is consistent with other BSDs. I don't have
a reference to POSIX.2 to verify the original specification.

Joerg
msg1680 (view) Author: guy Date: 2006-12-02.23:03:03
According to

     http://www.opengroup.org/onlinepubs/009695399/functions/confstr.html

confstr() should return 0, not (size_t)-1, on errors.  The current 
DragonFly BSD implementation returns -1 if sysctl() fails.
History
Date User Action Args
2006-12-06 12:01:48TGENsetstatus: testing -> resolved
assignedto: TGEN
messages: + msg1701
nosy: + TGEN
2006-12-05 22:28:01TGENsetfiles: + getconf.diff
messages: + msg1700
2006-12-05 22:02:31TGENsetpriority: bug
status: chatting -> testing
2006-12-05 19:29:01TGENsetfiles: + confstr.diff
messages: + msg1698
2006-12-04 20:23:00dillonsetmessages: + msg1696
2006-12-04 19:19:03guysetmessages: + msg1695
2006-12-04 11:15:02joergsetstatus: unread -> chatting
messages: + msg1694
2006-12-02 23:03:04guycreate