[BACK]Return to channels.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/channels.c between version 1.125 and 1.126

version 1.125, 2001/06/07 20:23:04 version 1.126, 2001/06/20 13:56:39
Line 223 
Line 223 
                 channels = xmalloc(channels_alloc * sizeof(Channel *));                  channels = xmalloc(channels_alloc * sizeof(Channel *));
                 for (i = 0; i < channels_alloc; i++)                  for (i = 0; i < channels_alloc; i++)
                         channels[i] = NULL;                          channels[i] = NULL;
                 /*                  fatal_add_cleanup((void (*) (void *)) channel_free_all, NULL);
                  * Kludge: arrange a call to channel_stop_listening if we  
                  * terminate with fatal().  
                  */  
                 fatal_add_cleanup((void (*) (void *)) channel_stop_listening, NULL);  
         }          }
         /* Try to find a free slot where to put the new channel. */          /* Try to find a free slot where to put the new channel. */
         for (found = -1, i = 0; i < channels_alloc; i++)          for (found = -1, i = 0; i < channels_alloc; i++)
Line 334 
Line 330 
         xfree(c);          xfree(c);
 }  }
   
   
 /*  
  * Stops listening for channels, and removes any unix domain sockets that we  
  * might have.  
  */  
   
 void  void
 channel_stop_listening()  channel_free_all(void)
 {  {
         int i;          int i;
         Channel *c;  
   
         for (i = 0; i < channels_alloc; i++) {          for (i = 0; i < channels_alloc; i++)
                 c = channels[i];                  if (channels[i] != NULL)
                 if (c != NULL) {                          channel_free(channels[i]);
                         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;  
                         }  
                 }  
         }  
 }  }
   
 /*  /*

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126