Create session before setting logname - we don't want to change the

parents logname (or any other children pre-empted in that window).
This commit is contained in:
dsl 2003-02-19 09:21:15 +00:00
parent 1cacc8d1a4
commit c17244d768

View File

@ -1,4 +1,4 @@
/* $NetBSD: do_command.c,v 1.11 2002/08/03 02:03:00 itojun Exp $ */ /* $NetBSD: do_command.c,v 1.12 2003/02/19 09:21:15 dsl Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie /* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved * All rights reserved
@ -22,7 +22,7 @@
#if 0 #if 0
static char rcsid[] = "Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp "; static char rcsid[] = "Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp ";
#else #else
__RCSID("$NetBSD: do_command.c,v 1.11 2002/08/03 02:03:00 itojun Exp $"); __RCSID("$NetBSD: do_command.c,v 1.12 2003/02/19 09:21:15 dsl Exp $");
#endif #endif
#endif #endif
@ -198,13 +198,13 @@ child_process(e, u)
#ifdef SYSLOG #ifdef SYSLOG
closelog(); closelog();
#endif #endif
if (setlogin(usernm) < 0)
syslog(LOG_ERR, "setlogin() failure: %m");
/* get new pgrp, void tty, etc. /* get new pgrp, void tty, etc.
*/ */
(void) setsid(); (void) setsid();
if (setlogin(usernm) < 0)
syslog(LOG_ERR, "setlogin() failure: %m");
/* close the pipe ends that we won't use. this doesn't affect /* close the pipe ends that we won't use. this doesn't affect
* the parent, who has to read and write them; it keeps the * the parent, who has to read and write them; it keeps the
* kernel from recording us as a potential client TWICE -- * kernel from recording us as a potential client TWICE --