From 4e837e7368b960191a231170f8716e1105e11dfa Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 18 Apr 2003 00:25:41 +0000 Subject: [PATCH] * syscalls.cc (setsid): Don't call FreeConsole if ctty is already < 0. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/syscalls.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0cfc97628..8704d9ec0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2003-04-17 Christopher Faylor + + * syscalls.cc (setsid): Don't call FreeConsole if ctty is already < 0. + 2003-04-17 Thomas Pfaff * Makefile.in: Add finline-functions optimization to CXXFLAGS. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 4a7e20f43..eb1055080 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -283,13 +283,13 @@ setsid (void) if (myself->pgid != myself->pid) { - myself->ctty = -1; - if (fhandler_console::open_fhs <= 0) + if (myself->ctty >= 0 && fhandler_console::open_fhs <= 0) { syscall_printf ("open_fhs %d, freeing console", fhandler_console::open_fhs); FreeConsole (); } + myself->ctty = -1; myself->sid = getpid (); myself->pgid = getpid (); syscall_printf ("sid %d, pgid %d, ctty %d", myself->sid, myself->pgid, myself->ctty);