[patch] aio_write

Amos Waterland apw@us.ibm.com
Fri Jun 14 10:16:00 GMT 2002


> >     % ./test0025
> >     ./test0025: did not fail (ret: 0), but errno: 4
> >     n a m e s e r v
> 
>     errno = 0;
>     if ((r = aio_read( &cb )))
>         error( 1, errno, "reading from file" );
> 
>     if (r == 0 && errno != 0)
>         error( 0, 0, "did not fail (ret: %i), but errno: %i", r, errno );
> 
> errno is undefined in this case, it can be as well 25431 or any other
> value.  Only a few functions are guaranteed not to change errno if no
> error occured (e.g. strtol family and a few others - for them errno =
> 0; strtol (); test errno is allowed). For the majority of functions
> the standards specify in which case they set errno (most often when
> functions return -1) and in the rest of cases errno is undefined.

Jakub:

You are right.  I checked the standard and it doesn't look like 
{ errno = 0; aio_*(); test errno } is guaranteed to be valid if the
return values were not -1.  Thanks.

Amos W.



More information about the Libc-alpha mailing list