added invalid socket check to read_socket function
This commit is contained in:
parent
b52f86a9a6
commit
72305929b2
@ -52,6 +52,8 @@ int main(void)
|
|||||||
|
|
||||||
received = read_socket(accepted);
|
received = read_socket(accepted);
|
||||||
|
|
||||||
|
if (received == NULL) continue; //FAILED
|
||||||
|
|
||||||
printf("Received:\n%s\n\n", received);
|
printf("Received:\n%s\n\n", received);
|
||||||
|
|
||||||
why2_deallocate(received);
|
why2_deallocate(received);
|
||||||
@ -65,6 +67,12 @@ int main(void)
|
|||||||
|
|
||||||
char *read_socket(int socket)
|
char *read_socket(int socket)
|
||||||
{
|
{
|
||||||
|
if (socket == -1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Reading socket failed.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
long content_size = 0;
|
long content_size = 0;
|
||||||
char *content = NULL;
|
char *content = NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user