From 92e2c1ad9de2d140374bf789b2eb6142b3297120 Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Mon, 12 Aug 2019 22:46:23 +0900 Subject: [PATCH] Cygwin: console: Fix deadlock at calling fork(). - Calling fork() on console occasionally falls into deadlock. The reason is not clear, however, this patch fixes this problem anyway. --- winsup/cygwin/fhandler_console.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index e3656a33a..df28c7f93 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -168,8 +168,12 @@ fhandler_console::set_unit () if (created) con.owner = getpid (); } - if (!created && shared_console_info && kill (con.owner, 0) == -1) - con.owner = getpid (); + if (!created && shared_console_info) + { + pinfo p (con.owner); + if (!p) + con.owner = getpid (); + } dev ().parse (devset); if (devset != FH_ERROR) -- 2.43.5