diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-06-21 03:19:23 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-06-21 03:19:23 +0000 |
commit | 601e43638e9e7889127634c3ba0949ba9fb917aa (patch) | |
tree | cf47af3b86f9260589980db64440cea4cd2d8dbd /channels.c | |
parent | 0a7ca6c7baf13265e86b98a40bfd00714d67c84e (diff) | |
download | openssh-git-601e43638e9e7889127634c3ba0949ba9fb917aa.tar.gz |
- markus@cvs.openbsd.org 2001/06/20 13:56:39
[channels.c channels.h clientloop.c packet.c serverloop.c]
move from channel_stop_listening to channel_free_all,
call channel_free_all before calling waitpid() in serverloop.
fixes the utmp handling; report from Lutz.Jaenicke@aet.TU-Cottbus.DE
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 40 |
1 files changed, 6 insertions, 34 deletions
@@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.125 2001/06/07 20:23:04 markus Exp $"); +RCSID("$OpenBSD: channels.c,v 1.126 2001/06/20 13:56:39 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -223,11 +223,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, channels = xmalloc(channels_alloc * sizeof(Channel *)); for (i = 0; i < channels_alloc; i++) channels[i] = NULL; - /* - * Kludge: arrange a call to channel_stop_listening if we - * terminate with fatal(). - */ - fatal_add_cleanup((void (*) (void *)) channel_stop_listening, NULL); + fatal_add_cleanup((void (*) (void *)) channel_free_all, NULL); } /* Try to find a free slot where to put the new channel. */ for (found = -1, i = 0; i < channels_alloc; i++) @@ -334,38 +330,14 @@ channel_free(Channel *c) xfree(c); } - -/* - * Stops listening for channels, and removes any unix domain sockets that we - * might have. - */ - void -channel_stop_listening() +channel_free_all(void) { int i; - Channel *c; - for (i = 0; i < channels_alloc; i++) { - c = channels[i]; - if (c != NULL) { - switch (c->type) { - case SSH_CHANNEL_AUTH_SOCKET: - close(c->sock); - /* auth_sock_cleanup_proc deletes the socket */ - channel_free(c); - break; - case SSH_CHANNEL_PORT_LISTENER: - case SSH_CHANNEL_RPORT_LISTENER: - case SSH_CHANNEL_X11_LISTENER: - close(c->sock); - channel_free(c); - break; - default: - break; - } - } - } + for (i = 0; i < channels_alloc; i++) + if (channels[i] != NULL) + channel_free(channels[i]); } /* |