mirror of
https://github.com/sheumann/hush.git
synced 2025-02-07 04:31:22 +00:00
Applied patch from Gennady Feldman to fix a single-threaded syslogd bug that
turned up. This code needs to be tested on an embedded system, since that's where the bug turned up in the first place.
This commit is contained in:
parent
2b549c3be0
commit
bff6b18bf9
@ -393,7 +393,9 @@ static int serveConnection (int conn)
|
|||||||
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
|
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
|
||||||
int n_read;
|
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);
|
int pri = (LOG_USER | LOG_NOTICE);
|
||||||
char line[ BUFSIZE + 1 ];
|
char line[ BUFSIZE + 1 ];
|
||||||
@ -427,7 +429,7 @@ static int serveConnection (int conn)
|
|||||||
/* Now log it */
|
/* Now log it */
|
||||||
logMessage (pri, line);
|
logMessage (pri, line);
|
||||||
}
|
}
|
||||||
return (0);
|
return n_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -550,9 +552,10 @@ static void doSyslogd (void)
|
|||||||
//printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
|
//printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
|
||||||
} else {
|
} else {
|
||||||
//printf("Serving connection: %i\n",fd);
|
//printf("Serving connection: %i\n",fd);
|
||||||
serveConnection (fd);
|
if ( serveConnection(fd) <= 0 ) {
|
||||||
close (fd);
|
close (fd);
|
||||||
FD_CLR(fd, &fds);
|
FD_CLR(fd, &fds);
|
||||||
|
}
|
||||||
} /* fd == sock_fd */
|
} /* fd == sock_fd */
|
||||||
}/* FD_ISSET() */
|
}/* FD_ISSET() */
|
||||||
}/* for */
|
}/* for */
|
||||||
|
@ -393,7 +393,9 @@ static int serveConnection (int conn)
|
|||||||
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
|
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
|
||||||
int n_read;
|
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);
|
int pri = (LOG_USER | LOG_NOTICE);
|
||||||
char line[ BUFSIZE + 1 ];
|
char line[ BUFSIZE + 1 ];
|
||||||
@ -427,7 +429,7 @@ static int serveConnection (int conn)
|
|||||||
/* Now log it */
|
/* Now log it */
|
||||||
logMessage (pri, line);
|
logMessage (pri, line);
|
||||||
}
|
}
|
||||||
return (0);
|
return n_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -550,9 +552,10 @@ static void doSyslogd (void)
|
|||||||
//printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
|
//printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
|
||||||
} else {
|
} else {
|
||||||
//printf("Serving connection: %i\n",fd);
|
//printf("Serving connection: %i\n",fd);
|
||||||
serveConnection (fd);
|
if ( serveConnection(fd) <= 0 ) {
|
||||||
close (fd);
|
close (fd);
|
||||||
FD_CLR(fd, &fds);
|
FD_CLR(fd, &fds);
|
||||||
|
}
|
||||||
} /* fd == sock_fd */
|
} /* fd == sock_fd */
|
||||||
}/* FD_ISSET() */
|
}/* FD_ISSET() */
|
||||||
}/* for */
|
}/* for */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user