than once.
* fhandler_tty.cc (fhandler_tty_slave::open): Protect some handles.
(fhandler_tty_common::close): Use proper name when closing handles.
(fhandler_pty_master::close): Don't close to_slave or from_slave since they've
already been closed earlier in the function.
* sigproc.cc (proc_subproc): Don't protect vchild->hProcess. Expect that the
caller will do this, instead.
* tty.cc (tty_list::terminate): Use proper name when closing handles.
(tty::make_pipes): Protect some handles.
+Mon Oct 16 21:36:57 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * debug.cc (add_handle): Issue warning on attempts to add the same
+ handle more than once.
+ * fhandler_tty.cc (fhandler_tty_slave::open): Protect some handles.
+ (fhandler_tty_common::close): Use proper name when closing handles.
+ (fhandler_pty_master::close): Don't close to_slave or from_slave since
+ they've already been closed earlier in the function.
+ * sigproc.cc (proc_subproc): Don't protect vchild->hProcess. Expect
+ that the caller will do this, instead.
+ * tty.cc (tty_list::terminate): Use proper name when closing handles.
+ (tty::make_pipes): Protect some handles.
+
Mon Oct 16 18:37:22 2000 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Remove some obsolete stuff.
handle_list *hl;
lock_debug ();
- if (find_handle (h))
- goto out; /* Already did this once */
+ if ((hl = find_handle (h)))
+ {
+ system_printf ("%s:%d - multiple attempts to add handle %s<%p>", func,
+ ln, name, h);
+ system_printf (" previously allocated by %s:%d(%s<%p>)",
+ hl->func, hl->ln, hl->name, hl->h);
+ goto out; /* Already did this once */
+ }
if ((hl = newh()) == NULL)
{
return 0;
}
set_io_handle (nh);
+ ProtectHandle1 (nh, from_pty);
termios_printf ("duplicated from_master %p->%p from tty_owner %p",
get_ttyp ()->from_master, nh, tty_owner);
if (!DuplicateHandle (tty_owner, get_ttyp ()->to_master, hMainProc, &nh, 0, TRUE,
return 0;
}
set_output_handle (nh);
+ ProtectHandle1 (nh, to_pty);
CloseHandle (tty_owner);
termios_printf("tty%d opened", ttynum);
termios_printf ("CloseHandle (inuse), %E");
if (!ForceCloseHandle (output_mutex))
termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
- if (!CloseHandle (get_handle ()))
+ if (!ForceCloseHandle1 (get_handle (), from_pty))
termios_printf ("CloseHandle (get_handle ()<%p>), %E", get_handle ());
- if (!CloseHandle (get_output_handle ()))
+ if (!ForceCloseHandle1 (get_output_handle (), to_pty))
termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
inuse = NULL;
if (!get_ttyp ()->master_alive ())
{
termios_printf ("freeing tty%d (%d)", ttynum, get_ttyp ()->ntty);
+#if 0
if (get_ttyp ()->to_slave)
- CloseHandle (get_ttyp ()->to_slave);
+ ForceCloseHandle1 (get_ttyp ()->to_slave, to_slave);
if (get_ttyp ()->from_slave)
- CloseHandle (get_ttyp ()->from_slave);
+ ForceCloseHandle1 (get_ttyp ()->from_slave, from_slave);
+#endif
if (get_ttyp ()->from_master)
CloseHandle (get_ttyp ()->from_master);
if (get_ttyp ()->to_master)
{
get_ttyp ()->from_slave = get_handle ();
get_ttyp ()->to_slave = get_output_handle ();
+ termios_printf ("from_slave %p, to_slave %p", get_handle (),
+ get_output_handle ());
}
}
pchildren[nchildren] = vchild;
hchildren[nchildren] = vchild->hProcess;
- ProtectHandle1 (vchild->hProcess, childhProc);
if (!DuplicateHandle (hMainProc, vchild->hProcess, hMainProc, &vchild->pid_handle,
0, 0, DUPLICATE_SAME_ACCESS))
system_printf ("Couldn't duplicate child handle for pid %d, %E", vchild->pid);
}
termios_printf ("tty %d master about to finish", ttynum);
- CloseHandle (t->to_slave);
- CloseHandle (t->from_slave);
+ ForceCloseHandle1 (t->to_slave, to_pty);
+ ForceCloseHandle1 (t->from_slave, from_pty);
WaitForSingleObject (tty_master->hThread, INFINITE);
t->init ();
return FALSE;
}
+ ProtectHandle1 (to_slave, to_pty);
if (CreatePipe (&from_slave, &to_master, &sec_all, 0) == FALSE)
{
termios_printf ("can't create output pipe");
set_errno (ENOENT);
return FALSE;
}
+ ProtectHandle1 (from_slave, from_pty);
termios_printf ("tty%d from_slave %p, to_slave %p", ntty, from_slave,
to_slave);
ptym->set_io_handle (from_slave);