fix inet_aton problem

svn path=/trunk/; revision=18687
This commit is contained in:
Christoph von Wittich 2005-10-22 20:02:03 +00:00
parent 1060e47c32
commit 5f32912b73
3 changed files with 5 additions and 3 deletions

View file

@ -30,6 +30,7 @@ u_int32_t arc4random()
return ret; return ret;
} }
int inet_aton(const char *cp, struct in_addr *inp) int inet_aton(const char *cp, struct in_addr *inp)
{ {
inp->S_un.S_addr = inet_addr(cp); inp->S_un.S_addr = inet_addr(cp);
@ -38,3 +39,4 @@ int inet_aton(const char *cp, struct in_addr *inp)
return 1; return 1;
} }

View file

@ -1986,7 +1986,7 @@ int
ipv4addrs(char * buf) ipv4addrs(char * buf)
{ {
char *tmp; char *tmp;
unsigned long jnk; struct in_addr jnk;
int i = 0; int i = 0;
note("Input: %s\n", buf); note("Input: %s\n", buf);
@ -1994,8 +1994,7 @@ ipv4addrs(char * buf)
do { do {
tmp = strtok(buf, " "); tmp = strtok(buf, " ");
note("got %s\n", tmp); note("got %s\n", tmp);
jnk = inet_addr( tmp ); if( tmp && inet_aton(tmp, &jnk) ) i++;
if( tmp ) i++;
buf = NULL; buf = NULL;
} while( tmp ); } while( tmp );

View file

@ -67,5 +67,6 @@ extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req );
extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req );
extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req );
extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req );
extern int inet_aton(const char *s, struct in_addr *addr);
int warn( char *format, ... ); int warn( char *format, ... );
#endif/*ROSDHCP_H*/ #endif/*ROSDHCP_H*/