projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use O_NOCTTY (if available) when opening /dev/ptmx, just in case any
[u/mdw/putty]
/
unix
/
uxpty.c
diff --git
a/unix/uxpty.c
b/unix/uxpty.c
index
36a05fc
..
99c1221
100644
(file)
--- a/
unix/uxpty.c
+++ b/
unix/uxpty.c
@@
-335,7
+335,14
@@
static void pty_open_master(Pty pty)
chown(pty->name, getuid(), gp ? gp->gr_gid : -1);
chmod(pty->name, 0600);
#else
chown(pty->name, getuid(), gp ? gp->gr_gid : -1);
chmod(pty->name, 0600);
#else
- pty->master_fd = open("/dev/ptmx", O_RDWR);
+
+ const int flags = O_RDWR
+#ifdef O_NOCTTY
+ | O_NOCTTY
+#endif
+ ;
+
+ pty->master_fd = open("/dev/ptmx", flags);
if (pty->master_fd < 0) {
perror("/dev/ptmx: open");
if (pty->master_fd < 0) {
perror("/dev/ptmx: open");