… | |
… | |
137 | } |
137 | } |
138 | |
138 | |
139 | return -1; |
139 | return -1; |
140 | } |
140 | } |
141 | |
141 | |
142 | #elif defined(HAVE_DEV_PTC) |
|
|
143 | |
|
|
144 | static int |
|
|
145 | get_pty (int *fd_tty, char **ttydev) |
|
|
146 | { |
|
|
147 | int pfd; |
|
|
148 | |
|
|
149 | if ((pfd = open ("/dev/ptc", O_RDWR | O_NOCTTY, 0)) >= 0) |
|
|
150 | { |
|
|
151 | *ttydev = strdup (ttyname (pfd)); |
|
|
152 | return pfd; |
|
|
153 | } |
|
|
154 | |
|
|
155 | return -1; |
|
|
156 | } |
|
|
157 | |
|
|
158 | #elif defined(HAVE_DEV_CLONE) |
|
|
159 | |
|
|
160 | static int |
|
|
161 | get_pty (int *fd_tty, char **ttydev) |
|
|
162 | { |
|
|
163 | int pfd; |
|
|
164 | |
|
|
165 | if ((pfd = open ("/dev/ptym/clone", O_RDWR | O_NOCTTY, 0)) >= 0) |
|
|
166 | { |
|
|
167 | *ttydev = strdup (ptsname (pfd)); |
|
|
168 | return pfd; |
|
|
169 | } |
|
|
170 | |
|
|
171 | return -1; |
|
|
172 | } |
|
|
173 | |
|
|
174 | #else |
142 | #else |
175 | |
143 | |
176 | /* Based on the code in openssh/openbsd-compat/bsd-openpty.c */ |
144 | /* Based on the code in openssh/openbsd-compat/bsd-openpty.c */ |
177 | static int |
145 | static int |
178 | get_pty (int *fd_tty, char **ttydev) |
146 | get_pty (int *fd_tty, char **ttydev) |