Commit dbe7ae64 authored by Niels Möller's avatar Niels Möller

* src/unix_random.c (do_device_source, random_init): Use

io_set_close_on_exec, to avoid fd:s leaking to user shells.
* src/werror.c (werror_argp_parser): Likewise.
* src/server_pty.c (pty_open_master): Likewise.
* src/io.c (lsh_pushd_fd): Likewise.
(lsh_pushd): Likewise. Also fixed EINTR logic.

Rev: src/server_pty.c:1.30
parent 86442144
......@@ -49,6 +49,7 @@
#include "channel.h"
#include "connection.h"
#include "format.h"
#include "io.h"
#include "lsh_string.h"
#include "parse.h"
#include "ssh.h"
......@@ -191,7 +192,9 @@ pty_open_master(struct pty_info *pty,
werror("pty_open_master: Opening /dev/ptmx failed %e\n", errno);
return 0;
}
io_set_close_on_exec(pty->master);
if ((name = pty_grantpt_uid(pty->master, user))
&& (unlockpt(pty->master) == 0))
{
......@@ -227,6 +230,9 @@ pty_open_master(struct pty_info *pty,
if (pty->master != -1)
{
/* master succesfully opened */
io_set_close_on_exec(pty->master);
snprintf(slave, sizeof(slave),
PTY_BSD_SCHEME_SLAVE, first[i], second[j]);
slave[sizeof(slave) - 1] = 0;
......@@ -282,6 +288,8 @@ pty_open_slave(struct pty_info *pty)
return -1;
}
io_set_close_on_exec(fd);
/* For Sys V and Solaris, push some streams modules.
* This seems to also have the side effect of making the
* tty become our controlling terminal. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment