svn commit: r202929 - stable/8/lib/libutil

Ed Schouten ed at
Sun Jan 24 14:30:58 UTC 2010

Author: ed
Date: Sun Jan 24 14:30:57 2010
New Revision: 202929

  MFC r202500:
    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

Directory Properties:
  stable/8/lib/libutil/   (props changed)

Modified: stable/8/lib/libutil/login_tty.c
--- stable/8/lib/libutil/login_tty.c	Sun Jan 24 14:29:40 2010	(r202928)
+++ stable/8/lib/libutil/login_tty.c	Sun Jan 24 14:30:57 2010	(r202929)
@@ -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);

More information about the svn-src-stable-8 mailing list