From 7d8964351b179f0df372ae3212a21062313d2084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Wed, 26 Oct 2022 14:54:12 +0800 Subject: [PATCH] fix pre c99 --- server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.c b/server.c index ca78017..56fff80 100644 --- a/server.c +++ b/server.c @@ -113,6 +113,7 @@ static int s3_set_data(threadtimer_t *timer); * 未被释放的资源以防止内存泄漏等 ***************************************/ static void accept_client() { + int i; signal(SIGINT, handle_int); signal(SIGQUIT, handle_quit); signal(SIGKILL, handle_segv); @@ -129,7 +130,7 @@ static void accept_client() { return; } if(r == 0) { // 超时 - for(int i = 0; i < THREADCNT; i++) { + for(i = 0; i < THREADCNT; i++) { if(timers[i].touch && timers[i].accept_fd) { time_t waitsec = time(NULL) - timers[i].touch; if(waitsec > MAXWAITSEC) { @@ -184,7 +185,7 @@ static void accept_client() { return; } HANDLE_CLIENTS: - for(int i = 0; i < THREADCNT; i++) { + for(i = 0; i < THREADCNT; i++) { if(timers[i].touch && timers[i].accept_fd) { if(FD_ISSET(timers[i].accept_fd, &rdfds)) { if(!handle_accept(&timers[i])) clean_timer(&timers[i]);