diff --git a/canlogserver.c b/canlogserver.c index 4429ccdb..b344df9d 100644 --- a/canlogserver.c +++ b/canlogserver.c @@ -151,7 +151,7 @@ int idx2dindex(int ifidx, int socket) return i; } -/* +/* * This is a Signalhandler. When we get a signal, that a child * terminated, we wait for it, so the zombie will disappear. */ @@ -303,7 +303,7 @@ int main(int argc, char **argv) exit(1); } } - + for (i=0; i 0) + close(s[i]); + goto close_accsocket; } if (mask[i] || value[i]) { @@ -371,17 +373,32 @@ int main(int argc, char **argv) while (running) { + int maxfd = accsocket; + FD_ZERO(&rdfs); - for (i=0; i maxfd ? s[i] : maxfd; FD_SET(s[i], &rdfs); + } - if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, NULL)) < 0) { + if ((ret = select(maxfd + 1, &rdfs, NULL, NULL, NULL)) < 0) { //perror("select"); running = 0; continue; } for (i=0; i