On Tue, 25 Nov 2003, Enache Adrian wrote:

> On Mon, Nov 24, 2003 a.d., Jacques A. Vidrine wrote:
> > The application is broken.  You must only check errno if you get an
> > error indication from the library call.
> 
> Sorry, but I don't see your point. I know when to check for errno.
> If you took the little illustrating program for a real life example of
> the use of errno, that's unfortunate :-)
> 
> The problem is that the emulated/wrapped close from libc_r does not
> behave like the real one. libc_r is leaking some of its guts
> (the tricks it's doing with O_NONBLOCK, etc) in the interface.
> This is technically a bug. The fix was trivial.

I don't see a bug.  You don't check errno unless the return is -1.
If the return is -1, then it must be because "ret = __sys_close(fd)"
failed in which case errno will be set appropriately.

Even so, there are other things to worry about aside from the fcntl
to set the flags.  The wrapped close also uses fstat(2) which can fail
in ways not listed by close(2).

-- 
Dan Eischen

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to