why the zombie create even if I use fork twice?

I use the code below:
int fork2()
{
pid_t pid;
int rc;
int status;

if (!(pid = fork()))
{
	switch (fork())
	{
	case 0:return 0;
	case -1: _exit(errno);
	default: _exit(0);
	}
}

if (pid < 0 || waitpid(pid,&status,0) < 0)
	return -1;

if (WIFEXITED(status))
	if (WEXITSTATUS(status) == 0)
		return 1;
	else
		errno = WEXITSTATUS(status);
	else
		errno = EINTR;

	return -1;

}

and another function
start()
{
struct sockaddr_in sock, peersock;
int socklength;
pid_t pid;

SOCKETBUILD:
printf(“build/rebuild socket…\n”);
if((init_socket_fd=socket(AF_INET,SOCK_STREAM,0))==-1)
{
printf(“phasor socket create error for %s!\n”, strerror(errno));
sleep(1);
goto SOCKETBUILD;

}

printf("phasor socket created successfully.\n");
f_netfunc.settcpattr(init_socket_fd);


memset(&sock,0,sizeof(struct sockaddr_in));
sock.sin_family=AF_INET;

// sock.sin_addr.s_addr=inet_addr(LOCALADDR); //modify by whz 080509
sock.sin_addr.s_addr=htonl(INADDR_ANY);
sock.sin_port=htons(LOCALPORT); //
socklength=sizeof(sock);

if(bind(init_socket_fd,(struct sockaddr *)&sock,socklength)<0)
{

  printf("phasor socket socket bind failure for %s!\n", strerror(errno));
  shutdown(init_socket_fd,2);
  close(init_socket_fd);
  delay(1000);
  goto SOCKETBUILD;
}

printf("phasor socket bind succefully.\n");

socklength=sizeof(peersock);
if(listen(init_socket_fd,1)==-1)
{
    printf("phasor socket listen error for %s!\n",strerror(errno));
	shutdown(init_socket_fd,2);
	close(init_socket_fd);

	goto SOCKETBUILD;
}

printf("phasor socket listen successfully...\n");

phasor_socket_fd=accept(init_socket_fd, (struct sockaddr*)&peersock,&socklength);
if(phasor_socket_fd==-1)
{

	  printf("phasor socket accept failed for %s!\n", strerror(errno));
	  shutdown(phasor_socket_fd,2);
	  shutdown(init_socket_fd,2);
	  close (phasor_socket_fd);
	  close(init_socket_fd);
	  sched_yield();
	  goto SOCKETBUILD;
}

f_netfunc.settcpattr(phasor_socket_fd);
printf("phasor socket built now.\n");


if(pid=fork2()==0)
{

	int socket_fd = phasor_socket_fd;

	unsigned char sendbuff[PHASOR_FRAME_LEN_MAX];
	U16 temp16;

	pid=getpid();
	setpgid(pid, pgrp);
	signal(SIGPIPE,SIG_IGN);


	while(1)
	{

// usleep(1000000);//500ms MakePhasorFrame contain sleep

		temp16=MakePhasorFrame(sendbuff);//contain sleep

		if( (f_netfunc.sendfunc( socket_fd, (unsigned char*)sendbuff, temp16, 5) )<=0 )
		{
			printf("send phase data error for %s!\n", strerror(errno));
			shutdown(socket_fd,2);
			close(socket_fd);
			break;
		}
	}

	_exit(EXIT_SUCCESS);

}


goto SOCKETBUILD;

}

when I exit from start “_exit(EXIT_SUCCESS);” it will be one zombie.

When I use “pidin family”,the ppid is 1 for zombie

as i understand, the fork2 is creating separate process for some socket task
when this task ends the process becomes zombie untill ist parent call waitpid
as the parent do not do waitpid but is creating other child processes, the children will soon make a “dead march”

I have counted fork and waitpid call so there are 2 forks and only 1 waitpid
I think the solution will be to catch sigchild in the main process and do a waitpid or maybe mark a vaariable and do waitpid further in a SOCKETBUILD loop