Re: strtonum(3) in FreeBSD?

From: Garance A Drosihn <drosih_at_rpi.edu>
Date: Wed, 13 Apr 2005 13:27:03 -0500
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
Received on Wed Apr 13 2005 - 15:27:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:32 UTC