Log all messages from a single connection, not just the first. Patch from

matthias@corelatus.com, approved by Gennady Feldman <gena01@cachier.com>.
This commit is contained in:
Matt Kraai 2001-08-14 17:32:23 +00:00
parent 0a68590314
commit b6ec78161d
2 changed files with 8 additions and 4 deletions

View File

@ -394,16 +394,17 @@ static int serveConnection (int conn)
{ {
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1); RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
int n_read; int n_read;
char *p = tmpbuf;
n_read = read (conn, tmpbuf, BUFSIZE ); n_read = read (conn, tmpbuf, BUFSIZE );
if (n_read > 0) { while (p < tmpbuf + n_read) {
int pri = (LOG_USER | LOG_NOTICE); int pri = (LOG_USER | LOG_NOTICE);
char line[ BUFSIZE + 1 ]; char line[ BUFSIZE + 1 ];
unsigned char c; unsigned char c;
char *p = tmpbuf, *q = line; char *q = line;
tmpbuf[ n_read - 1 ] = '\0'; tmpbuf[ n_read - 1 ] = '\0';
@ -428,6 +429,7 @@ static int serveConnection (int conn)
p++; p++;
} }
*q = '\0'; *q = '\0';
p++;
/* Now log it */ /* Now log it */
logMessage (pri, line); logMessage (pri, line);
} }

View File

@ -394,16 +394,17 @@ static int serveConnection (int conn)
{ {
RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1); RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
int n_read; int n_read;
char *p = tmpbuf;
n_read = read (conn, tmpbuf, BUFSIZE ); n_read = read (conn, tmpbuf, BUFSIZE );
if (n_read > 0) { while (p < tmpbuf + n_read) {
int pri = (LOG_USER | LOG_NOTICE); int pri = (LOG_USER | LOG_NOTICE);
char line[ BUFSIZE + 1 ]; char line[ BUFSIZE + 1 ];
unsigned char c; unsigned char c;
char *p = tmpbuf, *q = line; char *q = line;
tmpbuf[ n_read - 1 ] = '\0'; tmpbuf[ n_read - 1 ] = '\0';
@ -428,6 +429,7 @@ static int serveConnection (int conn)
p++; p++;
} }
*q = '\0'; *q = '\0';
p++;
/* Now log it */ /* Now log it */
logMessage (pri, line); logMessage (pri, line);
} }