summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-01-17 17:52:35 +0000
committered <ed@FreeBSD.org>2010-01-17 17:52:35 +0000
commit0c1620cc0b4e4548b8984f07cde7acac852d1ef7 (patch)
tree65fbe35bcaa21008118fc67cabff2018e28f9e94 /lib
parent47ae443fa5f3b739136606b138c2a4bc9b904974 (diff)
downloadFreeBSD-src-0c1620cc0b4e4548b8984f07cde7acac852d1ef7.zip
FreeBSD-src-0c1620cc0b4e4548b8984f07cde7acac852d1ef7.tar.gz
Fix a regression that was introduced in r191882.
I changed login_tty() to only work when the application is not a session leader yet. This works fine for applications in the base system, but it turns out various applications call this function after daemonizing, which means they already use their own session. If setsid() fails, just call tcsetsid() on the current session. tcsetsid() will already perform proper security checks. Reported by: Oliver Lehmann MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/login_tty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libutil/login_tty.c b/lib/libutil/login_tty.c
index a14e244..92dc87f 100644
--- a/lib/libutil/login_tty.c
+++ b/lib/libutil/login_tty.c
@@ -50,7 +50,7 @@ login_tty(int fd)
s = setsid();
if (s == -1)
- return (-1);
+ s = getsid(0);
if (tcsetsid(fd, s) == -1)
return (-1);
(void) dup2(fd, 0);
OpenPOWER on IntegriCloud