Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-10-07 11:52:30 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-10-07 11:52:30 +0400
commitb4311a90678d873611e2502e81b90b7cf6b4415a (patch)
tree431d7a28ae087eb79d53a692fd8c30a2bbfb976e /winsup
parentbd45d6fa76578b6c641d9deeae0a924e953ce78d (diff)
* fhandler.h (fhandler_pty_master::tcgetpgrp): Declare.
* fhandler_termios.cc (fhandler_termios::tcgetpgrp): Only return valid pgid if tty is controlling tty. Set errno to ENOTTY and return -1 otherwise. (fhandler_pty_master::tcgetpgrp): New function. Return 0 for master side of pty if it's not the controlling tty of the process.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_termios.cc11
3 files changed, 20 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ffa54719b..b1c7f3af1 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,12 @@
+2009-10-07 Corinna Vinschen <corinna@vinschen.de>
+
+ * fhandler.h (fhandler_pty_master::tcgetpgrp): Declare.
+ * fhandler_termios.cc (fhandler_termios::tcgetpgrp): Only return
+ valid pgid if tty is controlling tty. Set errno to ENOTTY and
+ return -1 otherwise.
+ (fhandler_pty_master::tcgetpgrp): New function. Return 0 for
+ master side of pty if it's not the controlling tty of the process.
+
2009-10-05 Charles Wilson <cygwin@cwilson.fastmail.fm>
Add cygwin wrapper for ExitProcess and TerminateProcess.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index dac0ce269..cb12d2b20 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1109,6 +1109,7 @@ public:
int dup (fhandler_base *);
void fixup_after_fork (HANDLE parent);
void fixup_after_exec ();
+ int tcgetpgrp ();
};
class fhandler_tty_master: public fhandler_pty_master
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index 8bdfdcd5d..b5d9f2ef3 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -99,7 +99,16 @@ fhandler_termios::tcsetpgrp (const pid_t pgid)
int
fhandler_termios::tcgetpgrp ()
{
- return tc->pgid;
+ if (myself->ctty != -1 && myself->ctty == tc->ntty)
+ return tc->pgid;
+ set_errno (ENOTTY);
+ return -1;
+}
+
+int
+fhandler_pty_master::tcgetpgrp ()
+{
+ return myself->ctty != -1 && myself->ctty == tc->ntty ? tc->pgid : 0;
}
void