lib-fd.c: accept() may accept NULL as the addrlen argument. Do not crash

when faced with this situation. Closes #54.
This commit is contained in:
Sam Hocevar 2009-03-20 23:28:51 +00:00 committed by sam
parent 8512c8cb0b
commit ff3df16094

View File

@ -256,8 +256,11 @@ int NEW(accept)(int sockfd, struct sockaddr *addr, SOCKLEN_T *addrlen)
if(ret >= 0)
{
debug("%s(%i, %p, &%i) = %i", __func__,
sockfd, addr, (int)*addrlen, ret);
if(addrlen)
debug("%s(%i, %p, &%i) = %i", __func__,
sockfd, addr, (int)*addrlen, ret);
else
debug("%s(%i, %p, NULL) = %i", __func__, sockfd, addr, ret);
_zz_register(ret);
}