diff options
author | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-06-04 18:31:57 +0000 |
---|---|---|
committer | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-06-04 18:31:57 +0000 |
commit | 09e967c2d732783b2579e4e120cd9b608404cb00 (patch) | |
tree | 8d2783a6a7e33608c6012efd6a88b8f5694df81d /mdk-stage1/dietlibc/libcruft/inet_pton.c | |
parent | 18fcff49d3c836697d3b75a3d01d31c700e69974 (diff) | |
download | drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar.gz drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar.bz2 drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar.xz drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.zip |
Merge from R9_0-AMD64, most notably:
- AMD64 support to insmod-busybox, minilibc, et al.
- Sync with insmod-modutils 2.4.19 something but everyone should use
dietlibc nowadays
- Factor out compilation and prefix with $(DIET) for dietlibc builds
- 64-bit & varargs fixes
Diffstat (limited to 'mdk-stage1/dietlibc/libcruft/inet_pton.c')
-rw-r--r-- | mdk-stage1/dietlibc/libcruft/inet_pton.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mdk-stage1/dietlibc/libcruft/inet_pton.c b/mdk-stage1/dietlibc/libcruft/inet_pton.c index d5c17509c..a62785d5f 100644 --- a/mdk-stage1/dietlibc/libcruft/inet_pton.c +++ b/mdk-stage1/dietlibc/libcruft/inet_pton.c @@ -1,6 +1,9 @@ #include <stdlib.h> +#include <sys/socket.h> #include <arpa/inet.h> #include <errno.h> +#include <string.h> +#include "dietfeatures.h" static unsigned int scan_ip6(const char *s,char ip[16]) { @@ -9,8 +12,8 @@ static unsigned int scan_ip6(const char *s,char ip[16]) unsigned long u; char suffix[16]; - int prefixlen=0; - int suffixlen=0; + unsigned int prefixlen=0; + unsigned int suffixlen=0; for (i=0; i<16; i++) ip[i]=0; @@ -26,7 +29,7 @@ static unsigned int scan_ip6(const char *s,char ip[16]) } { char *tmp; - u=strtol(s,&tmp,16); + u=strtoul(s,&tmp,16); i=tmp-s; } @@ -60,7 +63,7 @@ static unsigned int scan_ip6(const char *s,char ip[16]) i=tmp-s; } if (!i) { - len--; + if (*s) len--; break; } if (suffixlen+prefixlen<=12 && s[i]=='.') { @@ -83,12 +86,14 @@ static unsigned int scan_ip6(const char *s,char ip[16]) } int inet_pton(int AF, const char *CP, void *BUF) { + int len; if (AF==AF_INET) { if (!inet_aton(CP,(struct in_addr*)BUF)) return 0; } else if (AF==AF_INET6) { - if (CP[scan_ip6(CP,BUF)]) - return 0; + if (CP[len=scan_ip6(CP,BUF)]) + if (CP[len]!='%') /* allow "fe80::220:e0ff:fe69:ad92%eth0" */ + return 0; } else { errno=EAFNOSUPPORT; return -1; |