diff options
author | ache <ache@FreeBSD.org> | 1997-07-04 22:09:07 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-07-04 22:09:07 +0000 |
commit | d4280e0ef8cbd23f489bfc51f752045ef774a77f (patch) | |
tree | 38eb0f192d663056e9c6ed0f8638c5f4e6d7fe06 /sbin | |
parent | 85002b50ef9884682b293d4c723f3ede66a478d2 (diff) | |
download | FreeBSD-src-d4280e0ef8cbd23f489bfc51f752045ef774a77f.zip FreeBSD-src-d4280e0ef8cbd23f489bfc51f752045ef774a77f.tar.gz |
death: revoke all lines listed in /etc/ttys instead of sending HUP
to all processes
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/init/init.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c index fda577a..ebc95a2 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: init.c,v 1.19 1997/07/02 13:53:31 ache Exp $ + * $Id: init.c,v 1.20 1997/07/03 11:37:43 ache Exp $ */ #ifndef lint @@ -1393,7 +1393,10 @@ death() register session_t *sp; register int i; pid_t pid; - static const int death_sigs[3] = { SIGHUP, SIGTERM, SIGKILL }; + char *devname; + int tlen_cur, tlen_max; + struct ttyent *typ; + static const int death_sigs[2] = { SIGTERM, SIGKILL }; for (sp = sessions; sp; sp = sp->se_next) sp->se_flags |= SE_SHUTDOWN; @@ -1401,7 +1404,28 @@ death() /* NB: should send a message to the session logger to avoid blocking. */ logwtmp("~", "shutdown", ""); - for (i = 0; i < 3; ++i) { + tlen_max = 0; + devname = NULL; + while (typ = getttyent()) { + if (typ->ty_name != 0) { + tlen_cur = strlen(typ->ty_name); + if (tlen_cur > 0) { + if (tlen_cur > tlen_max) { + tlen_max = tlen_cur; + devname = realloc(devname, sizeof(_PATH_DEV) + tlen_max); + } + if (devname != NULL) { + (void) sprintf(devname, "%s%s", _PATH_DEV, typ->ty_name); + (void) revoke(devname); + } + } + } + } + endttyent(); + if (devname != NULL) + free(devname); + + for (i = 0; i < 2; ++i) { if (kill(-1, death_sigs[i]) == -1 && errno == ESRCH) return (state_func_t) single_user; |