summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-07-05 19:36:55 +0000
committerache <ache@FreeBSD.org>1997-07-05 19:36:55 +0000
commitbaa3a4dbcc2e60f0cc512528ee89ef3f0ab262b0 (patch)
tree4c332837c2a8e14f9db4f2638bc3e228ea3f9a08 /sbin
parentbae151f4e56893244ca6a05e90ae61cbc80d06df (diff)
downloadFreeBSD-src-baa3a4dbcc2e60f0cc512528ee89ef3f0ab262b0.zip
FreeBSD-src-baa3a4dbcc2e60f0cc512528ee89ef3f0ab262b0.tar.gz
1. Replace malloc+bzero by calloc
2. Revoke internal active session list only now, not whole /etc/ttys
Diffstat (limited to 'sbin')
-rw-r--r--sbin/init/init.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index ebc95a2..e3913db 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.20 1997/07/03 11:37:43 ache Exp $
+ * $Id: init.c,v 1.21 1997/07/04 22:09:07 ache Exp $
*/
#ifndef lint
@@ -936,8 +936,7 @@ new_session(sprev, session_index, typ)
typ->ty_getty == 0)
return 0;
- sp = (session_t *) malloc(sizeof (session_t));
- bzero(sp, sizeof *sp);
+ sp = (session_t *) calloc(1, sizeof (session_t));
sp->se_index = session_index;
@@ -1393,38 +1392,16 @@ death()
register session_t *sp;
register int i;
pid_t pid;
- 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)
+ for (sp = sessions; sp; sp = sp->se_next) {
sp->se_flags |= SE_SHUTDOWN;
+ (void) revoke(sp->se_device);
+ }
/* NB: should send a message to the session logger to avoid blocking. */
logwtmp("~", "shutdown", "");
- 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;
OpenPOWER on IntegriCloud