]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Fix a bug in tty_min::segpgid().
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Sat, 12 Feb 2022 20:12:18 +0000 (05:12 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Sun, 13 Feb 2022 14:55:59 +0000 (23:55 +0900)
- In tty_min::setpgid(), a pointer to fhandler instance is casted to
  fhandler_pty_slave and accessed even if terminal is not a pty slave.
  This patch fixes the issue.

winsup/cygwin/tty.cc

index da75b8dd2e4ac57760f9c965bc8b9154907b014a..c0015aceb4342e451f179eae6f4a1296b73a316c 100644 (file)
@@ -309,7 +309,8 @@ tty_min::setpgid (int pid)
   fhandler_pty_slave *ptys = NULL;
   cygheap_fdenum cfd (false);
   while (cfd.next () >= 0 && ptys == NULL)
-    if (cfd->get_device () == getntty ())
+    if (cfd->get_device () == getntty ()
+       && cfd->get_major () == DEV_PTYS_MAJOR)
       ptys = (fhandler_pty_slave *) (fhandler_base *) cfd;
 
   if (ptys)
This page took 0.03537 seconds and 5 git commands to generate.