fopen(3) returning NULL (with workaround.)

Roland C. Dowdeswell elric at
Wed Oct 27 11:26:35 EDT 2004

On 1098888207 seconds since the Beginning of the UNIX epoch
"Douglas E. Engert" wrote:

>I have seen a similiar problem with open failing in the profile
>code but te profile code tried to use the handle. It has to do
>with shared libs and the definition of errno as a function or
>an extern.
>With Solaris I build Kerberos with  -D_TS_ERRNO
>See the /usr/include/errno.h

Strictly speaking, though, the Solaris 7 fopen man page states:

     Upon successful completion, fopen() returns a pointer to the
     object controlling the stream.  Otherwise, a null pointer is
     returned and errno is set to indicate the error.

     The fopen() function may fail and not set errno if there are
     no free stdio streams.

So, relying on errno to be set appropriately if fopen() returns
NULL is incorrect according to the Solaris' documentation.

    Roland Dowdeswell                      http://www.Imrryr.ORG/~elric/

More information about the krbdev mailing list