Commit Graph

12 Commits

Author SHA1 Message Date
Ed Schouten
2c8d07a874 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
2010-01-17 17:52:35 +00:00
Ed Schouten
46b303e83d Add tcsetsid(3).
The entire world seems to use the non-standard TIOCSCTTY ioctl to make a
TTY a controlling terminal of a session. Even though tcsetsid(3) is also
non-standard, I think it's a lot better to use in our own source code,
mainly because it's similar to tcsetpgrp(), tcgetpgrp() and tcgetsid().

I stole the idea from QNX. They do it the other way around; their
TIOCSCTTY is just a wrapper around tcsetsid(). tcsetsid() then calls
into an IPC framework.
2009-05-07 13:49:48 +00:00
Warner Losh
ee7093a640 Remove California Regent's clause 3, per letter 2007-01-09 01:02:06 +00:00
Mark Murray
547fa0d9b7 ANSIfy, WARNSify, CONSTify. Bit of style(9)-ify. 2003-10-18 10:04:16 +00:00
Mark Murray
0ebec5d3c8 Tidy up. Sort headers. 2003-06-14 18:42:37 +00:00
Matthew Dillon
8719c58fef Add __FBSDID()s to libutil 2001-09-30 22:35:07 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Jordan K. Hubbard
8b1ef8d464 Now take stdio.h out of files that don't require it. 1998-10-09 11:24:20 +00:00
Jordan K. Hubbard
b8c11ec197 All these have to include stdio.h now. 1998-10-09 00:39:09 +00:00
Steve Price
673b794638 Protect the copyright comments from reformatting by
indent and make this compile -Wall clean like the
Makefile suggests that it should. :)

Pointed out by:	Bruce Evans <bde@zeta.org.au>
1997-08-13 20:42:18 +00:00
Peter Wemm
3b7e1cc80f Bump libutil revision after recent addition of setproctitle().
Install (optional) libutil.h with prototypes for the functions and
document this in the man page.

minor cleanups to the various routines, include the prototype file, declare
return codes etc.
1996-01-01 08:27:41 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00