strtonum(3) in FreeBSD?

Garance A Drosihn drosih at rpi.edu
Wed Apr 13 10:27:07 PDT 2005


At 5:59 PM +1000 4/13/05, Peter Jeremy wrote:
>
>>  but this is unintuitive to anyone who
>  >is used to the broken POSIX way of doing it.
>
>I would dispute the 'broken' adjective.  Having errno only affected by
>errors means that you can issue a series of system calls and determine
>that something failed - which may be enough.

Uh, no.  This can get you into trouble, if one of those system
routines called some other system routine, and that other system
routine "failed", but in a way which is not really an error for
the routine you called.

This happens if a system routine is calling 'stat()' for some
*optional* config file, for instance.  It is not an error to you at
all if that optional config file does not exist, but errno will have
been set.

Note that I have lost time debugging non-problems because of
programmers who used this "time-saving trick" of just checking
errno (instead of checking the actual return-code from the
routines they called).  It is very annoying.

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-current mailing list