Getting a compile error here.. RedHat 7.3 machine
websvr.c: In function `handle_web':
websvr.c:377: parse error before `int'
websvr.c:378: `curlen' undeclared (first use in this function)
websvr.c:378: (Each undeclared identifier is reported only once
websvr.c:378: for each function it appears in.)
make: *** [o/websvr.o] Error 1
Checked the code - LOOKS alright. That's both with the patch and with the downloaded distro.
[jwalker@kenetix src]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
I can't see anything wrong with the code though.
if( FD_ISSET( current->fd, &readfds ) ) /* We Got Data! */
if( ( numbytes = read( current->fd, buf, sizeof(buf) ) ) == -1 )
perror( "web-read" );
buf[numbytes] = '�';
/* ensure that we won't crash on a buffer overflow */
int curlen = strlen( current->request );
strncat( current->request, buf, 2 * MAXDATA - curlen - 6 );
/* we don't want to miss the trailing ENDREQUEST */
if( strlen( current->request ) == 2 * MAXDATA - 6 ) /* buffer size reached */
/* we could miss the end of request, but we don't need it anyway */
strcat( current->request, ENDREQUEST );
} /* DONE WITH DATA IN */
that's the block there I do think. It'd error out earlier if not.