[En-Nut-Discussion] Bug in app httpserv
Tyou
tyou at i-da.co.jp
Sat Aug 2 20:39:43 CEST 2003
file app/httpserv.c function ShowSockets:
fprintf_P(stream, tfmt,
ts,
inet_ntoa(ts->so_local_addr),
ntohs(ts->so_local_port),
inet_ntoa(ts->so_remote_addr),
ntohs(ts->so_remote_port));
not works well...change it like this:
{
char ip_str[16];
strcpy(ip_str, (char*)inet_ntoa(ts->so_local_addr));
fprintf_P(stream, tfmt,
ts,
ip_str,
ntohs(ts->so_local_port),
inet_ntoa(ts->so_remote_addr),
ntohs(ts->so_remote_port));
}
or change function inet_ntoa
u_char *inet_ntoa(u_long addr)
{
static u_char str[4][16];
static u_char rnd = 0;
u_char inv[3];
u_char *rp;
u_char *ap;
u_char rem;
u_char n;
u_char i;
if (++rnd == 4)
rnd = 0;
rp = str[rnd];
ap = (u_char *) & addr;
for (n = 0; n < 4; n++) {
i = 0;
do {
rem = *ap % (u_char) 10;
*ap /= (u_char) 10;
inv[i++] = '0' + rem;
} while (*ap);
while (i--)
*rp++ = inv[i];
*rp++ = '.';
ap++;
}
*--rp = 0;
return str[rnd];
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20030803/6dfdbf7f/attachment.html
More information about the En-Nut-Discussion
mailing list