fixes needed to compile with a standard compliant libc

remote-dns
rofl0r 2011-09-02 19:55:50 +02:00
parent f85edffeea
commit 7cde272e29
2 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <memory.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <netdb.h> #include <netdb.h>
@ -215,7 +215,7 @@ static int tunnel_to(int sock, unsigned int ip, unsigned short port, proxy_type
{ {
int len; int len;
char buff[BUFF_SIZE]; char buff[BUFF_SIZE];
bzero (buff,sizeof(buff)); memset (buff, 0, sizeof(buff));
switch(pt) switch(pt)
{ {
case HTTP_TYPE: case HTTP_TYPE:
@ -243,7 +243,7 @@ static int tunnel_to(int sock, unsigned int ip, unsigned short port, proxy_type
if(len!=send(sock,buff,len,0)) if(len!=send(sock,buff,len,0))
return SOCKET_ERROR; return SOCKET_ERROR;
bzero(buff,sizeof(buff)); memset(buff, 0, sizeof(buff));
len=0 ; len=0 ;
// read header byte by byte. // read header byte by byte.
while(len<BUFF_SIZE) while(len<BUFF_SIZE)
@ -410,7 +410,7 @@ static int start_chain(int *fd, proxy_data *pd, char* begin_mark)
inet_ntoa(*(struct in_addr*)&pd->ip), inet_ntoa(*(struct in_addr*)&pd->ip),
htons(pd->port)); htons(pd->port));
pd->ps=PLAY_STATE; pd->ps=PLAY_STATE;
bzero(&addr,sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_addr.s_addr = pd->ip; addr.sin_addr.s_addr = pd->ip;
addr.sin_port = pd->port; addr.sin_port = pd->port;
@ -645,7 +645,7 @@ struct hostent* proxy_gethostbyname(const char *name)
if(!strcmp(buff,name)) if(!strcmp(buff,name))
goto got_buff; goto got_buff;
bzero(buff,sizeof(buff)); memset(buff, 0, sizeof(buff));
// TODO: this works only once, so cache it ... // TODO: this works only once, so cache it ...
// later // later
@ -711,8 +711,8 @@ int proxy_getaddrinfo(const char *node, const char *service,
sockaddr_space = malloc(sizeof(struct sockaddr)); sockaddr_space = malloc(sizeof(struct sockaddr));
if(!sockaddr_space) if(!sockaddr_space)
goto err2; goto err2;
bzero(sockaddr_space, sizeof(*sockaddr_space)); memset(sockaddr_space, 0, sizeof(*sockaddr_space));
bzero(addrinfo_space, sizeof(*addrinfo_space)); memset(addrinfo_space, 0, sizeof(*addrinfo_space));
if (node && if (node &&
!inet_aton(node,&((struct sockaddr_in*)sockaddr_space)->sin_addr)) { !inet_aton(node,&((struct sockaddr_in*)sockaddr_space)->sin_addr)) {
hp = proxy_gethostbyname(node); hp = proxy_gethostbyname(node);

View File

@ -21,7 +21,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <memory.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <netdb.h> #include <netdb.h>
@ -29,7 +29,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/fcntl.h> #include <fcntl.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -186,7 +186,7 @@ static inline void get_chain_data(
while(fgets(buff,sizeof(buff),file)) { while(fgets(buff,sizeof(buff),file)) {
if(buff[strspn(buff," ")]!='#') { if(buff[strspn(buff," ")]!='#') {
if(list) { if(list) {
bzero(&pd[count], sizeof(proxy_data)); memset(&pd[count], 0, sizeof(proxy_data));
pd[count].ps=PLAY_STATE; pd[count].ps=PLAY_STATE;
port_n=0; port_n=0;
sscanf(buff,"%s %s %d %s %s", type,host,&port_n, sscanf(buff,"%s %s %d %s %s", type,host,&port_n,
@ -378,7 +378,7 @@ void freeaddrinfo(struct addrinfo *res)
int getnameinfo (const struct sockaddr * sa, int getnameinfo (const struct sockaddr * sa,
socklen_t salen, char * host, socklen_t salen, char * host,
socklen_t hostlen, char * serv, socklen_t hostlen, char * serv,
socklen_t servlen, unsigned int flags) socklen_t servlen, int flags)
{ {
int ret = 0; int ret = 0;
if(!init_l) if(!init_l)