diff options
author | truckman <truckman@FreeBSD.org> | 1998-11-09 15:08:04 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 1998-11-09 15:08:04 +0000 |
commit | a2af3a6c6c15b7eca638b34ca50e37c6f4f3f8e3 (patch) | |
tree | e0ce117bebd708970017ec03fdb12380311ec08d /sys/kern/kern_proc.c | |
parent | 0ba40b32fa2a18e3c58c8d152e72598fae7208f1 (diff) | |
download | FreeBSD-src-a2af3a6c6c15b7eca638b34ca50e37c6f4f3f8e3.zip FreeBSD-src-a2af3a6c6c15b7eca638b34ca50e37c6f4f3f8e3.tar.gz |
If the session leader dies, s_leader is set to NULL and getsid() may
dereference a NULL pointer, causing a panic. Instead of following
s_leader to find the session id, store it in the session structure.
Jukka found the following info:
BTW - I just found what I have been looking for. Std 1003.1
Part 1: SYSTEM API [C LANGUAGE] section 2.2.2.80 states quite
explicitly...
Session lifetime: The period between when a session is created
and the end of lifetime of all the process groups that remain
as members of the session.
So, this quite clearly tells that while there is any single
process in any process group which is a member of the session,
the session remains as an independent entity.
Reviewed by: peter
Submitted by: "Jukka A. Ukkonen" <jau@jau.tmt.tele.fi>
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index e229a5d..d546ad7 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 - * $Id: kern_proc.c,v 1.36 1998/02/20 13:52:14 bde Exp $ + * $Id: kern_proc.c,v 1.37 1998/07/11 07:45:40 bde Exp $ */ #include <sys/param.h> @@ -223,6 +223,7 @@ enterpgrp(p, pgid, mksess) MALLOC(sess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK); sess->s_leader = p; + sess->s_sid = p->p_pid; sess->s_count = 1; sess->s_ttyvp = NULL; sess->s_ttyp = NULL; |