From abbcbb099008dfed895adbd54d60f10e4129c7aa Mon Sep 17 00:00:00 2001
From: Masatake YAMATO <yamato@redhat.com>
Date: Wed, 5 Dec 2018 00:12:06 +0900
Subject: [PATCH 60/83] endpoint(pseudoterminal),bug fix: fix wrong Unix98 PTY
 slaves major number detection

A typo was in the code detecting Unix98 PTY slave device.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
 dialects/linux/dnode.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/dialects/linux/dnode.c b/dialects/linux/dnode.c
index 68b6a04..fa60557 100644
--- a/dialects/linux/dnode.c
+++ b/dialects/linux/dnode.c
@@ -354,8 +354,21 @@ int
 is_pty_slave(sm)
 	int sm;				/* slave major device number */
 {
+	/* linux/Documentation/admin-guide/devices.txt
+	   -------------------------------------------
+	   136-143 char	Unix98 PTY slaves
+		  0 = /dev/pts/0	First Unix98 pseudo-TTY
+		  1 = /dev/pts/1	Second Unix98 pseudo-TTY
+		    ...
+
+		These device nodes are automatically generated with
+		the proper permissions and modes by mounting the
+		devpts filesystem onto /dev/pts with the appropriate
+		mount options (distribution dependent, however, on
+		*most* distributions the appropriate options are
+		"mode=0620,gid=<gid of the "tty" group>".) */
 	if ((UNIX98_PTY_SLAVE_MAJOR <= sm)
-	&&  (sm < (UNIX98_PTY_SLAVE_MAJOR + UNIX98_PTY_SLAVE_MAJOR))
+	&&  (sm < (UNIX98_PTY_SLAVE_MAJOR + UNIX98_PTY_MAJOR_COUNT))
 	) {
 	    return 1;
 	}
-- 
1.8.3.1

