modify p-client child return value
This commit is contained in:
parent
aaeba28fb8
commit
50eb6f4cf7
@ -266,6 +266,7 @@ int main(int argc, const char *argv[]){
|
||||
int fd, pid;
|
||||
char ip_buf[INET_ADDRSTRLEN];
|
||||
const char * msg;
|
||||
int retval = 0;
|
||||
if((csock = accept(sock, (struct sockaddr *)&client_addr,&client_addr_len)) < 0){
|
||||
free(buf);
|
||||
perror("accept error");
|
||||
@ -276,13 +277,14 @@ int main(int argc, const char *argv[]){
|
||||
pid = fork();
|
||||
if(pid == 0){
|
||||
if((fd = read_request(csock,buf,bufsize)) > 0){
|
||||
send_response(csock,fd,buf,bufsize);
|
||||
retval = send_response(csock,fd,buf,bufsize);
|
||||
close(fd);
|
||||
}
|
||||
else retval = fd;
|
||||
if(close(csock) < 0)
|
||||
perror("csock close error");
|
||||
free(buf);
|
||||
return 0;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user