This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: warnings on handle close
- To: cygwin-patches at cygwin dot com
- Subject: Re: warnings on handle close
- From: Christopher Faylor <cgf at redhat dot com>
- Date: Mon, 22 Oct 2001 17:09:15 -0400
- References: <123196306794.20011023002445@logos-m.ru>
- Reply-To: cygwin-patches at cygwin dot com
On Tue, Oct 23, 2001 at 12:24:45AM +0400, egor duda wrote:
>Hi!
>
> this program complains about error on handle close.
>
>#include <sys/fcntl.h>
>
>int main ()
>{
> int f = open ("/dev/tty", O_RDWR);
> fcntl (f, F_SETFD, 1);
> close (f);
>}
>
>the reason is that we duplicate handle when fcntl is called, but it's
>old handle value that's left registered in handle list.
>patch attached.
I'm surprised that this is necessary. I thought that the same handle was
reused in this situation. However, even if that was the case, I shouldn't
have relied on that undocumented fact.
I think that I can come up with a slightly less intrusive change than this
one, involving an additional argument to setclexec_pid.
I'll check something in shortly.
Thanks for tracking this down. These kind of problems can be very
frustrating and difficult to unearth.
cgf