diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-26 01:09:46 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-26 01:09:46 +0000 |
commit | ecf2793bffe34a7300f20b77ab39b67a6e939e59 (patch) | |
tree | 4f61a7fd5a6a3ebbca053c55dc68b8a3edb7700b /libbb | |
parent | e4d50cf154eab6730b3ba1dfb443d36d63a6ba3e (diff) | |
download | busybox-w32-ecf2793bffe34a7300f20b77ab39b67a6e939e59.tar.gz busybox-w32-ecf2793bffe34a7300f20b77ab39b67a6e939e59.tar.bz2 busybox-w32-ecf2793bffe34a7300f20b77ab39b67a6e939e59.zip |
xconnect is non-conforming to "xfunc like libc" rule. Fixing
git-svn-id: svn://busybox.net/trunk/busybox@16440 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xconnect.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c index f88136a1a..7cf9d00e9 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c | |||
@@ -49,14 +49,20 @@ void bb_lookup_host(struct sockaddr_in *s_in, const char *host) | |||
49 | memcpy(&(s_in->sin_addr), he->h_addr_list[0], he->h_length); | 49 | memcpy(&(s_in->sin_addr), he->h_addr_list[0], he->h_length); |
50 | } | 50 | } |
51 | 51 | ||
52 | int xconnect(struct sockaddr_in *s_addr) | 52 | void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) |
53 | { | 53 | { |
54 | int s = xsocket(AF_INET, SOCK_STREAM, 0); | 54 | if (connect(s, s_addr, addrlen) < 0) { |
55 | if (connect(s, (struct sockaddr *)s_addr, sizeof(struct sockaddr_in)) < 0) | ||
56 | { | ||
57 | if (ENABLE_FEATURE_CLEAN_UP) close(s); | 55 | if (ENABLE_FEATURE_CLEAN_UP) close(s); |
58 | bb_perror_msg_and_die("unable to connect to remote host (%s)", | 56 | if (s_addr->sa_family == AF_INET) |
59 | inet_ntoa(s_addr->sin_addr)); | 57 | bb_perror_msg_and_die("unable to connect to remote host (%s)", |
58 | inet_ntoa(((struct sockaddr_in *)s_addr)->sin_addr)); | ||
59 | bb_perror_msg_and_die("unable to connect to remote host"); | ||
60 | } | 60 | } |
61 | } | ||
62 | |||
63 | int xconnect_tcp_v4(struct sockaddr_in *s_addr) | ||
64 | { | ||
65 | int s = xsocket(AF_INET, SOCK_STREAM, 0); | ||
66 | xconnect(s, (struct sockaddr*) s_addr, sizeof(*s_addr)); | ||
61 | return s; | 67 | return s; |
62 | } | 68 | } |