Commit c4a424eb 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/io.c (lsh_pushd_fd): Likewise.
(lsh_pushd): Likewise. Also fixed EINTR logic.

Rev: src/io.c:1.216
parent ff24d140
......@@ -1813,6 +1813,8 @@ lsh_pushd_fd(int dir)
return -1;
}
io_set_close_on_exec(old_cd);
/* Test if we are allowed to cd to our current working directory. */
while (fchdir(old_cd) < 0)
if (errno != EINTR)
......@@ -1909,13 +1911,16 @@ lsh_pushd(const char *directory,
return -1;
}
io_set_close_on_exec(old_cd);
/* Test if we are allowed to cd to our current working directory. */
while (fchdir(old_cd) < 0)
{
werror("io.c: fchdir(\".\") failed %e\n", errno);
close(fd);
close(old_cd);
return -1;
if (errno != EINTR)
{
werror("io.c: fchdir(\".\") failed %e\n", errno);
close(fd);
close(old_cd);
return -1;
}
/* As far as I have been able to determine, all checks for
......
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