Fix mlogc 100 cpu problem

This commit is contained in:
brenosilva
2012-02-27 16:58:05 +00:00
parent 86ea715e27
commit 621f2ac3ff

View File

@@ -421,8 +421,10 @@ static int read_queue_entries(apr_file_t *fd, apr_time_t *queue_time)
{
char linebuf[4100];
int line_count = -1;
int line_size = 0;
for(;;) {
memset(linebuf, 0, 4100);
apr_status_t rc = apr_file_gets(linebuf, 4096, fd);
char *p;
@@ -440,14 +442,16 @@ static int read_queue_entries(apr_file_t *fd, apr_time_t *queue_time)
}
p = &linebuf[0];
line_size = strlen(p);
/* Remove the \n from the end of the line. */
while(*p != '\0') {
while(*p != '\0' && line_size > 0) {
if (*p == '\n') {
*p = '\0';
break;
}
p++;
line_size--;
}
if (linebuf[0] == '#') { /* Ignore comments. */