sscanf always generates error condition

Steve Summit scs at adam.mit.edu
Thu May 9 13:43:02 AEST 1991


In article <1474 at ecicrl.ocunix.on.ca> clewis at ferret.ocunix.on.ca (Chris Lewis) writes:
>In article <1991May7.020259.3646 at athena.mit.edu> scs at adam.mit.edu writes:
>>(to quote
>>from an old version of the comp.lang.c frequently-asked questions
>>list), "it is only meaningful for a program to inspect the
>>contents of errno after an error has occurred (that is, after a
>>library function that sets errno on error has returned an error
> ^^^^^^^^^^^^^^^^
>>code)."
>
>The underlined phrase should be "system call".  Library routines
>can return an error yet the errno won't indicate the real reason
>for the failure.

It's hard to word correctly.  I had revised it several times, and
it still wasn't perfect.  It can't just say "system call,"
however, because a few library routines (e.g. many of the math
routines) *are* documented as setting errno.  There are also
non-Unix systems which have emulators for Unix system calls
present in the C library.  Finally, since system calls themselves
are invariably accessed through tiny routines also present in
"the library" (i.e. /lib/libc.a), I cheated and talked about
"library routine[s] that set errno on error."  I would not have
been so cavalier in a Unix FAQ list.

>(The more common guise under which this issue comes up
>>is "Why does errno contain ENOTTY after a call to printf?")
>
>Put the way this usually crops up: "Why did your sendmail bounce
>my mail with a:
>	550 ... Not a tty
>message" ;-)

Indeed.  (I'd forgotten the "real" question; thanks for the
reminder.)

                                            Steve Summit
                                            scs at adam.mit.edu



More information about the Comp.unix.programmer mailing list