diff --git a/nbase/nbase_str.c b/nbase/nbase_str.c index fa522f127..2214b4e3f 100644 --- a/nbase/nbase_str.c +++ b/nbase/nbase_str.c @@ -158,8 +158,9 @@ char *mkstr(const char *start, const char *end) { /* Like strchr, but don't go past end. Nulls not handled specially. */ const char *strchr_p(const char *str, const char *end, char c) { + const char *q=str; assert(str && end >= str); - for (const char *q = str; q < end; q++) { + for (; q < end; q++) { if (*q == c) return q; } diff --git a/ncat/ncat_listen.c b/ncat/ncat_listen.c index 6c78da336..fdd079d9c 100644 --- a/ncat/ncat_listen.c +++ b/ncat/ncat_listen.c @@ -192,7 +192,7 @@ int new_listen_socket(int type, int proto, const union sockaddr_u *addr, fd_set int ncat_listen() { - int rc, i, fds_ready; + int rc, i, j, fds_ready; fd_set listen_fds; struct timeval tv; struct timeval *tvp = NULL; @@ -405,7 +405,7 @@ restart_fd_loop: goto restart_fd_loop; /* Check if any send errors were logged. */ - for (int j = 0; j < broadcast_fdlist.nfds; j++) { + for (j = 0; j < broadcast_fdlist.nfds; j++) { fdi = &broadcast_fdlist.fds[j]; if (fdi->lasterr != 0) { close_fd(fdi, 0); @@ -458,7 +458,8 @@ static void handle_connection(int socket_accept, int type, fd_set *listen_fds) && s.remoteaddr.storage.ss_family != AF_UNIX #endif ) { - for (int i = 0; i < num_listenaddrs; i++) { + int i; + for (i = 0; i < num_listenaddrs; i++) { if (listen_socket[i] == socket_accept) { struct fdinfo *lfdi = get_fdinfo(&client_fdlist, socket_accept); union sockaddr_u localaddr = lfdi->remoteaddr;