From 99a5bd2fab6ba7e81ffa3d0709199b75264a3651 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 16 Jun 2001 17:09:19 +0000 Subject: [PATCH] * exceptions.cc (sig_handle_tty_stop): Reset PID_STOPPED if not actually stopping. * fhandler_console.cc (fhandler_console::fixup_after_fork): Don't set controlling terminal if just inheriting a handle. (fhandler_console::fixup_after_exec): Ditto. * fhandler_tty.cc (fhandler_tty_slave::init): Ditto. * signal.cc (kill_worker): Set appropriate errno if proc_exists determines that process does not really exist. --- winsup/cygwin/ChangeLog | 13 ++++++++++++- winsup/cygwin/exceptions.cc | 5 ++++- winsup/cygwin/fhandler_console.cc | 4 ++-- winsup/cygwin/fhandler_tty.cc | 2 +- winsup/cygwin/path.cc | 3 +-- winsup/cygwin/signal.cc | 6 +++++- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e32840c6c..218b0c73d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +Sat Jun 16 13:06:49 2001 Christopher Faylor + + * exceptions.cc (sig_handle_tty_stop): Reset PID_STOPPED if not + actually stopping. + * fhandler_console.cc (fhandler_console::fixup_after_fork): Don't set + controlling terminal if just inheriting a handle. + (fhandler_console::fixup_after_exec): Ditto. + * fhandler_tty.cc (fhandler_tty_slave::init): Ditto. + * signal.cc (kill_worker): Set appropriate errno if proc_exists + determines that process does not really exist. + Fri Jun 15 14:34:19 2001 Christopher Faylor * path.cc (path_conv::check): Deal more robustly with foo/ behavior. @@ -2422,7 +2433,7 @@ Wed Jan 17 09:47:13 2001 Christopher Faylor * exceptions.cc (sig_handle_tty_stop): Move setting of PID_STOPPED to earlier in interrupt. - ((interrupt_setup): i.e., here. + (interrupt_setup): i.e., here. (sig_handle): Don't queue multiple SIGSTOPS. * fhandler.h (bg_check_types): Enumerate return value of bg_check for clarity. diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 82ba131c2..9ec179bea 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -587,7 +587,10 @@ sig_handle_tty_stop (int sig) /* Silently ignore attempts to suspend if there is no accomodating cygwin parent to deal with this behavior. */ if (!myself->ppid_handle) - return; + { + myself->process_state &= ~PID_STOPPED; + return; + } myself->stopsig = sig; /* See if we have a living parent. If so, send it a special signal. * It will figure out exactly which pid has stopped by scanning diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index cf95eccce..b09eeff69 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1728,7 +1728,7 @@ fhandler_console::fixup_after_fork (HANDLE) /* Windows does not allow duplication of console handles between processes so open the console explicitly. */ - if (!open (get_name (), get_flags (), 0)) + if (!open (get_name (), O_NOCTTY | get_flags (), 0)) system_printf ("error opening console after fork, %E"); if (!get_close_on_exec ()) @@ -1758,7 +1758,7 @@ fhandler_console::fixup_after_exec (HANDLE) HANDLE h = get_handle (); HANDLE oh = get_output_handle (); - if (!open (get_name (), get_flags (), 0)) + if (!open (get_name (), O_NOCTTY | get_flags (), 0)) { int sawerr = 0; if (!get_io_handle ()) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 293f4e636..f0076cabf 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -574,7 +574,7 @@ fhandler_tty_slave::init (HANDLE, DWORD a, mode_t) if (a == (GENERIC_READ | GENERIC_WRITE)) mode = O_RDWR; - open (0, mode); + open (0, mode | O_NOCTTY); } int diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 414efcf11..20c71f58f 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2987,8 +2987,7 @@ getwd (char *buf) } /* chdir: POSIX 5.2.1.1 */ -extern "C" -int +extern "C" int chdir (const char *in_dir) { int dir_error = check_null_empty_path (in_dir); diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 714c31f4b..fcb82cd11 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -160,7 +160,11 @@ kill_worker (pid_t pid, int sig) dest = myself_nowait_nonmain; #endif if (sig == 0) - res = proc_exists (dest) ? 0 : -1; + { + res = proc_exists (dest) ? 0 : -1; + if (res < 0) + set_errno (ESRCH); + } else if ((res = sig_send (dest, sig))) { sigproc_printf ("%d = sig_send, %E ", res);