This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [patch] aio_write
- From: Amos Waterland <apw at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 14 Jun 2002 12:11:51 -0500
- Subject: 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.