Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jan 2010 17:52:35 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r202500 - head/lib/libutil
Message-ID:  <201001171752.o0HHqZPU099660@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Sun Jan 17 17:52:35 2010
New Revision: 202500
URL: http://svn.freebsd.org/changeset/base/202500

Log:
  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

Modified:
  head/lib/libutil/login_tty.c

Modified: head/lib/libutil/login_tty.c
==============================================================================
--- head/lib/libutil/login_tty.c	Sun Jan 17 17:49:28 2010	(r202499)
+++ head/lib/libutil/login_tty.c	Sun Jan 17 17:52:35 2010	(r202500)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001171752.o0HHqZPU099660>