This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] aio_write


> >     % ./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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]