[uClibc] uClibc and squid
Piotr Klaban
makler+uclibc at man.torun.pl
Fri Aug 22 12:40:56 UTC 2003
Hi,
I've tried to compile squid (both 2.5 and 3.0[beta])
under uClibc. It compiles OK under
http://www.uclibc.org/downloads/root_fs-i386.bz2
but I can not run it because any IP address
from squid.conf is recognized as unsafe:
2003/08/22 05:55:28| DecodeAddress: unsafe IP address: '0.0.0.0'
FATAL: DecodeAddress: unsafe IP address
It seems that sscanf function from uClibc (correct?)
does not work properly (or just do not work like glibc,
and squid does not work).
The problematic function sscaf is in src/ACLIP.cc:194 (of squid-3.0)
and lib/safe_inet_addr.c.
Simple test script:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
char x;
char buf[64];
snprintf(buf,12,"%s","0.0.0.0");
if (sscanf(buf, "%d.%d.%d.%d%c", &a1, &a2, &a3, &a4, &x) != 4) {
fprintf(stderr,"%s scanf to %d\n", buf, sscanf(buf, "%d.%d.%d.%d%c", &a1, &a2, &a3, &a4, &x));
fprintf(stderr,"%s scanf to %d.%d.%d.%d.%x.%c\n", buf, a1, a2, a3, a4, x, x);
return -1;
}
printf("ok\n");
return 0;
}
After running the command:
gcc -Wall -o test test.c
it prints
ok\n
After:
gcc -Wall -o test test.c -static
it prints:
0.0.0.0 scanf to 5
0.0.0.0 scanf to 0.0.0.0.0.^@
squid always fails and it not depoends on the -static compilation.
Best regards,
--
Piotr Klaban
More information about the uClibc
mailing list