Commit 7c35fe2e authored by Niels Möller's avatar Niels Möller
Browse files

* src/server_pty.c (pty_open_slave): Removed call to setsid(),

moved to...
* src/unix_user.c (do_spawn): Call setsid(). Was previously done by
the pty code, and only in the pty case.

Rev: src/server_pty.c:1.24
Rev: src/unix_user.c:1.55
parent d2eae79f
...@@ -255,12 +255,6 @@ pty_open_slave(struct pty_info *pty) ...@@ -255,12 +255,6 @@ pty_open_slave(struct pty_info *pty)
int fd; int fd;
trace("pty_open_slave\n"); trace("pty_open_slave\n");
if (setsid() < 0)
{
werror("tty_setctty: setsid failed, already process group leader?\n"
" %e\n", errno);
return -1;
}
/* Open the slave. On Sys V, that also makes it our controlling tty. */ /* Open the slave. On Sys V, that also makes it our controlling tty. */
fd = open(lsh_get_cstring(pty->tty_name), O_RDWR); fd = open(lsh_get_cstring(pty->tty_name), O_RDWR);
......
...@@ -806,6 +806,14 @@ do_spawn(struct lsh_user *u, ...@@ -806,6 +806,14 @@ do_spawn(struct lsh_user *u,
trace("do_spawn: child after chdir\n"); trace("do_spawn: child after chdir\n");
/* We want to be a process group leader */
if (setsid() < 0)
{
werror("unix_user: setsid failed, already process group leader?\n"
" %e\n", errno);
_exit(EXIT_FAILURE);
}
#if WITH_PTY_SUPPORT #if WITH_PTY_SUPPORT
if (info->pty) if (info->pty)
{ {
......
Supports Markdown
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