From 5d5f5e2e345e85e03f375d45bef5a60d960c8603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Sat, 20 Sep 2003 09:30:53 +0200 Subject: [PATCH] * 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. Fix backported from lsh-1.5. Rev: ChangeLog:1.527.2.7 Rev: NEWS:1.100.2.3 Rev: src/server_pty.c:1.22.2.1 Rev: src/unix_user.c:1.52.2.1 --- ChangeLog | 5 +++++ NEWS | 3 +++ src/server_pty.c | 6 ------ src/unix_user.c | 8 ++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 982fb60e..ebd253f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ * Released lsh-1.4.3. + * 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. Fix backported from lsh-1.5. + * misc/mkdiff: Copied the script from the old lsh_1_2_BRANCH. 2003-09-19 Niels Möller diff --git a/NEWS b/NEWS index 39c4fbc3..d4181ca1 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ News for the 1.4.3 release failure in the handling of channel_open, and in the experimental client SRP code. + Backported lshd setsid fix from lsh-1.5. Should call setsid + both in the pty and non-pty cases. + Updated the code to compile with automake-1.7.3 and scsh-0.6.0. diff --git a/src/server_pty.c b/src/server_pty.c index 462116fd..6f4128b4 100644 --- a/src/server_pty.c +++ b/src/server_pty.c @@ -257,12 +257,6 @@ pty_open_slave(struct pty_info *pty) int fd; trace("pty_open_slave\n"); - if (setsid() < 0) - { - werror("tty_setctty: setsid failed, already process group leader?\n" - " (errno = %i): %z\n", errno, STRERROR(errno)); - return -1; - } /* Open the slave. On Sys V, that also makes it our controlling tty. */ fd = open(lsh_get_cstring(pty->tty_name), O_RDWR); diff --git a/src/unix_user.c b/src/unix_user.c index ea17f09b..7c26db19 100644 --- a/src/unix_user.c +++ b/src/unix_user.c @@ -813,6 +813,14 @@ do_spawn(struct lsh_user *u, 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 (info->pty) { -- GitLab