Samuel Thibault wrote:
Hello,
+ char sock_serv_env_name[30];
To avoid a fixed-sized buffer you could use __asprintf.
+ name = (char *)malloc (len + 100);
Use __asprintf here too.
- servers[domain] = server;
+ servers[domain] = server;
Spurious hook, please try to minimize these.
About the ChangeLog entry, it needs to be more precise: add the
environment variable and macro _names_ since that's what people would
grep for.
Samuel
I tried to use __asprintf, and the code is below:
if (domain > max_domain || servers[domain] == MACH_PORT_NULL)
{
char *name = NULL;
char *np = NULL;
if (__asprintf (&name, "SOCK_SERV_%d", domain) > 0)
{
np = getenv (name);
free (name);
}
name = NULL;
if (np == NULL)
{
char *sock_servs = NULL;
sock_servs = getenv ("SOCK_SERV");
if (sock_servs == NULL)
sock_servs = _SERVERS_SOCKET;
if (__asprintf (&name, "%s/%d", sock_servs, domain) > 0)
np = name;
else
name = NULL;
}
if (np)
{
server = __file_name_lookup (np, 0, 0);
if (domain <= max_domain)
servers[domain] = server;
}
if (name)
free (name);
}
else
server = servers[domain];
When I build the glibc, I got the error as follow:
CPP='gcc-4.2 -E -x c-header'
/root/storage/glibc-2.7/build-tree/hurd-i386-libc/elf/ld.so.1
--library-path
/root/storage/glibc-2.7/build-tree/hurd-i386-libc:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/math:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/elf:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/dlfcn:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/nss:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/nis:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/rt:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/resolv:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/crypt:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/mach:/root/storage/glibc-2.7/build-tree/hurd-i386-libc/hurd:/X11R6/lib
/root/storage/glibc-2.7/build-tree/hurd-i386-libc/sunrpc/rpcgen -Y
../scripts -c rpcsvc/bootparam_prot.x -o
/root/storage/glibc-2.7/build-tree/hurd-i386-libc/sunrpc/xbootparam_prot.T
rpcgen: hurdmalloc.c:287: _hurd_free: Assertion `((h)->check) ==
0x8a3c743e' failed.
make[2]: ***
[/root/storage/glibc-2.7/build-tree/hurd-i386-libc/sunrpc/xbootparam_prot.stmp]
Aborted
make[2]: Leaving directory
`/root/storage/glibc-2.7/build-tree/glibc-2.7/sunrpc'
make[1]: *** [sunrpc/others] Error 2
make[1]: Leaving directory `/root/storage/glibc-2.7/build-tree/glibc-2.7'
make: *** [all] Error 2
I don't understand what the error means and I cannot find any problems
in my code myself.
Can anyone see the problem in my code?
Best,
Zheng Da