This is the mail archive of the cygwin-patches mailing list for the Cygwin 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]

Fix leaky pipe

  As discussed elsewhere, here's a patch that solves the race problem without leaking handles any more by placing the
master-pipe-closing logic where it really belongs, in fhandler_tty_common::close where the send-an-EOF decision is made.  I figured
4 extra bytes in the vtable isn't too bad, it's not like you expect to have millions of terminals open at once.

  This isn't ready to checkin immediately because I haven't had a chance to test it yet.  It builds OK but I have to wait for my gcc
testsuite run to complete before I can actually replace the dll and test it.  Once that's out of the way, I'll test it and run the
before-and-after testsuite; if I have to make changes I will resubmit but I don't expect to.

2006-05-29  Dave Korn  <>


	* fhandler.h (fhandler_tty_common::pre_eof_hook):  New virtual
	member function for use of masters when shutting down.
	(fhandler_pty_master::pre_eof_hook):  Declare override. 
	* (fhandler_tty_common::close):  Call pre_eof_hook
	before signalling EOF to slaves if master no longer alive.
	(fhandler_tty_common::pre_eof_hook):  Do-nothing stub.
	(fhandler_pty_master::pre_eof_hook):  Close master pipes here to
	avoid race condition.
	(fhandler_pty_master::close):  Remove code now in pre_eof_hook.

Can't think of a witty .sigline today....

Attachment: leaky-pipe-patch.diff
Description: Binary data

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