diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-11-11 21:38:38 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-11-11 21:45:03 +0900 |
commit | 87cd4f3fbd06217ce44c5da4e94fa6af59e8e39b (patch) | |
tree | ef78aa949d189bf020028d525f88c9e364216c38 /winsup/cygwin | |
parent | 6876520793f332370f91086debeba839e1acd127 (diff) | |
download | newlib-87cd4f3fbd06217ce44c5da4e94fa6af59e8e39b.zip newlib-87cd4f3fbd06217ce44c5da4e94fa6af59e8e39b.tar.gz newlib-87cd4f3fbd06217ce44c5da4e94fa6af59e8e39b.tar.bz2 |
Cygwin: console Add comment for the recent change
Fixes: 30d266947842 ("Cygwin: console: Fix clean up conditions in close()")
Suggested-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/fhandler/console.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc index 2651e49..0660ee3 100644 --- a/winsup/cygwin/fhandler/console.cc +++ b/winsup/cygwin/fhandler/console.cc @@ -1984,6 +1984,15 @@ fhandler_console::close () NTSTATUS status; status = NtQueryObject (get_handle (), ObjectBasicInformation, &obi, sizeof obi, NULL); + /* If the process is not myself->cygstarted and is the console owner, + the process is the last process on this console device. The console + owner has two console handles, i.e. one is io_handle and the other + is the dupplicated handle for cons_master_thread. + If myself->cygstarted is false and the process is not console owner, + the process is supposed to be started by the exec command in the + owner shell. In this case, the owner process is still alive in the + background and waiting for this process. So the handle count is + three (two in the owner process, one is mine). */ if (NT_SUCCESS (status) && obi.HandleCount == (con.owner == GetCurrentProcessId () ? 2 : 3)) { |