RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
int n_read;
- while ((n_read = read (conn, tmpbuf, BUFSIZE )) > 0) {
+ n_read = read (conn, tmpbuf, BUFSIZE );
+
+ if (n_read > 0) {
int pri = (LOG_USER | LOG_NOTICE);
char line[ BUFSIZE + 1 ];
/* Now log it */
logMessage (pri, line);
}
- return (0);
+ return n_read;
}
int len = sizeof(remoteaddr);
bzero(&remoteaddr, len);
-
+
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
if (remotefd < 0) {
FD_SET(conn, &fds);
//printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
- } else {
+ } else {
//printf("Serving connection: %i\n",fd);
- serveConnection (fd);
- close (fd);
- FD_CLR(fd, &fds);
+ if ( serveConnection(fd) <= 0 ) {
+ close (fd);
+ FD_CLR(fd, &fds);
+ }
} /* fd == sock_fd */
}/* FD_ISSET() */
}/* for */
if ( (p = strchr(RemoteHost, ':'))){
RemotePort = atoi(p+1);
*p = '\0';
- }
+ }
doRemoteLog = TRUE;
break;
case 'L':
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
int n_read;
- while ((n_read = read (conn, tmpbuf, BUFSIZE )) > 0) {
+ n_read = read (conn, tmpbuf, BUFSIZE );
+
+ if (n_read > 0) {
int pri = (LOG_USER | LOG_NOTICE);
char line[ BUFSIZE + 1 ];
/* Now log it */
logMessage (pri, line);
}
- return (0);
+ return n_read;
}
int len = sizeof(remoteaddr);
bzero(&remoteaddr, len);
-
+
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
if (remotefd < 0) {
FD_SET(conn, &fds);
//printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
- } else {
+ } else {
//printf("Serving connection: %i\n",fd);
- serveConnection (fd);
- close (fd);
- FD_CLR(fd, &fds);
+ if ( serveConnection(fd) <= 0 ) {
+ close (fd);
+ FD_CLR(fd, &fds);
+ }
} /* fd == sock_fd */
}/* FD_ISSET() */
}/* for */
if ( (p = strchr(RemoteHost, ':'))){
RemotePort = atoi(p+1);
*p = '\0';
- }
+ }
doRemoteLog = TRUE;
break;
case 'L':