patch to initialize sockaddr by Jarda Benkovsky
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -30,6 +31,7 @@ sock_init_sockaddr (sockaddr_in * name, const char *hostname, unsigned short int
|
|||||||
{
|
{
|
||||||
struct hostent *hostinfo;
|
struct hostent *hostinfo;
|
||||||
|
|
||||||
|
memset (name, 0, sizeof (*name));
|
||||||
name->sin_family = AF_INET;
|
name->sin_family = AF_INET;
|
||||||
name->sin_port = htons (port);
|
name->sin_port = htons (port);
|
||||||
hostinfo = gethostbyname (hostname);
|
hostinfo = gethostbyname (hostname);
|
||||||
|
|||||||
Reference in New Issue
Block a user