summaryrefslogtreecommitdiffstats
path: root/channels.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-13 21:18:00 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-13 21:18:00 +1000
commitc7a6fc41bfdcd73469b153437a8e75e0b1057894 (patch)
tree4ad8c688ec8a08573b3c2efa38af1dcc5df24222 /channels.c
parent03669a363eb8c76f460a75adc11d0eb933e4af49 (diff)
- avsm@cvs.openbsd.org 2004/08/11 21:43:05
[channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c] some signed/unsigned int comparison cleanups; markus@ ok
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/channels.c b/channels.c
index cf46ce09..1f6984aa 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.208 2004/07/11 17:48:47 deraadt Exp $");
+RCSID("$OpenBSD: channels.c,v 1.209 2004/08/11 21:43:04 avsm Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -68,7 +68,7 @@ static Channel **channels = NULL;
* Size of the channel array. All slots of the array must always be
* initialized (at least the type field); unused slots set to NULL
*/
-static int channels_alloc = 0;
+static u_int channels_alloc = 0;
/*
* Maximum file descriptor value used in any of the channels. This is
@@ -141,7 +141,7 @@ channel_lookup(int id)
{
Channel *c;
- if (id < 0 || id >= channels_alloc) {
+ if (id < 0 || (u_int)id >= channels_alloc) {
logit("channel_lookup: %d: bad id", id);
return NULL;
}
@@ -209,7 +209,8 @@ Channel *
channel_new(char *ctype, int type, int rfd, int wfd, int efd,
u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock)
{
- int i, found;
+ int found;
+ u_int i;
Channel *c;
/* Do initial allocation if this is the first call. */
@@ -223,10 +224,10 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
for (found = -1, i = 0; i < channels_alloc; i++)
if (channels[i] == NULL) {
/* Found a free slot. */
- found = i;
+ found = (int)i;
break;
}
- if (found == -1) {
+ if (found < 0) {
/* There are no free slots. Take last+1 slot and expand the array. */
found = channels_alloc;
if (channels_alloc > 10000)
@@ -273,7 +274,8 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
static int
channel_find_maxfd(void)
{
- int i, max = 0;
+ u_int i;
+ int max = 0;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -322,12 +324,12 @@ void
channel_free(Channel *c)
{
char *s;
- int i, n;
+ u_int i, n;
for (n = 0, i = 0; i < channels_alloc; i++)
if (channels[i])
n++;
- debug("channel %d: free: %s, nchannels %d", c->self,
+ debug("channel %d: free: %s, nchannels %u", c->self,
c->remote_name ? c->remote_name : "???", n);
s = channel_open_message();
@@ -353,7 +355,7 @@ channel_free(Channel *c)
void
channel_free_all(void)
{
- int i;
+ u_int i;
for (i = 0; i < channels_alloc; i++)
if (channels[i] != NULL)
@@ -368,7 +370,7 @@ channel_free_all(void)
void
channel_close_all(void)
{
- int i;
+ u_int i;
for (i = 0; i < channels_alloc; i++)
if (channels[i] != NULL)
@@ -382,7 +384,7 @@ channel_close_all(void)
void
channel_stop_listening(void)
{
- int i;
+ u_int i;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -439,7 +441,7 @@ channel_not_very_much_buffered_data(void)
int
channel_still_open(void)
{
- int i;
+ u_int i;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -482,7 +484,7 @@ channel_still_open(void)
int
channel_find_open(void)
{
- int i;
+ u_int i;
Channel *c;
for (i = 0; i < channels_alloc; i++) {
@@ -530,7 +532,7 @@ channel_open_message(void)
Buffer buffer;
Channel *c;
char buf[1024], *cp;
- int i;
+ u_int i;
buffer_init(&buffer);
snprintf(buf, sizeof buf, "The following connections are open:\r\n");
@@ -1674,7 +1676,7 @@ static void
channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
{
static int did_init = 0;
- int i;
+ u_int i;
Channel *c;
if (!did_init) {
@@ -1697,10 +1699,9 @@ channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)
*/
void
channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
- int *nallocp, int rekeying)
+ u_int *nallocp, int rekeying)
{
- int n;
- u_int sz;
+ u_int n, sz;
n = MAX(*maxfdp, channel_max_fd);
@@ -1736,8 +1737,7 @@ void
channel_output_poll(void)
{
Channel *c;
- int i;
- u_int len;
+ u_int i, len;
for (i = 0; i < channels_alloc; i++) {
c = channels[i];
@@ -2270,7 +2270,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
int
channel_cancel_rport_listener(const char *host, u_short port)
{
- int i, found = 0;
+ u_int i;
+ int found = 0;
for(i = 0; i < channels_alloc; i++) {
Channel *c = channels[i];
@@ -2572,7 +2573,7 @@ channel_connect_to(const char *host, u_short port)
void
channel_send_window_changes(void)
{
- int i;
+ u_int i;
struct winsize ws;
for (i = 0; i < channels_alloc; i++) {