~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Patch from Colin Watson intended to give a clean Unix compile with GCC 4.
[sgt/putty]
/
unix
/
uxpty.c
diff --git
a/unix/uxpty.c
b/unix/uxpty.c
index
637eaa1
..
cc01a67
100644
(file)
--- a/
unix/uxpty.c
+++ b/
unix/uxpty.c
@@
-275,8
+275,10
@@
static void fatal_sig_handler(int signum)
static int pty_open_slave(Pty pty)
{
static int pty_open_slave(Pty pty)
{
- if (pty->slave_fd < 0)
+ if (pty->slave_fd < 0)
{
pty->slave_fd = open(pty->name, O_RDWR);
pty->slave_fd = open(pty->name, O_RDWR);
+ cloexec(pty->slave_fd);
+ }
return pty->slave_fd;
}
return pty->slave_fd;
}
@@
-307,6
+309,8
@@
static void pty_open_master(Pty pty)
strcpy(pty->name, master_name);
pty->name[5] = 't'; /* /dev/ptyXX -> /dev/ttyXX */
strcpy(pty->name, master_name);
pty->name[5] = 't'; /* /dev/ptyXX -> /dev/ttyXX */
+ cloexec(pty->master_fd);
+
if (pty_open_slave(pty) >= 0 &&
access(pty->name, R_OK | W_OK) == 0)
goto got_one;
if (pty_open_slave(pty) >= 0 &&
access(pty->name, R_OK | W_OK) == 0)
goto got_one;
@@
-346,6
+350,8
@@
static void pty_open_master(Pty pty)
exit(1);
}
exit(1);
}
+ cloexec(pty->master_fd);
+
pty->name[FILENAME_MAX-1] = '\0';
strncpy(pty->name, ptsname(pty->master_fd), FILENAME_MAX-1);
#endif
pty->name[FILENAME_MAX-1] = '\0';
strncpy(pty->name, ptsname(pty->master_fd), FILENAME_MAX-1);
#endif
@@
-1008,10
+1014,10
@@
static const struct telnet_special *pty_get_specials(void *handle)
return NULL;
}
return NULL;
}
-static
Socket pty_socket
(void *handle)
+static
int pty_connected
(void *handle)
{
/* Pty pty = (Pty)handle; */
{
/* Pty pty = (Pty)handle; */
- return
NULL; /* shouldn't ever be needed */
+ return
TRUE;
}
static int pty_sendok(void *handle)
}
static int pty_sendok(void *handle)
@@
-1068,7
+1074,7
@@
Backend pty_backend = {
pty_size,
pty_special,
pty_get_specials,
pty_size,
pty_special,
pty_get_specials,
- pty_
socket
,
+ pty_
connected
,
pty_exitcode,
pty_sendok,
pty_ldisc,
pty_exitcode,
pty_sendok,
pty_ldisc,