summaryrefslogtreecommitdiffstats
path: root/lib/libc/net
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/getaddrinfo.c4
-rw-r--r--lib/libc/net/name6.c10
-rw-r--r--lib/libc/net/rcmd.c40
-rw-r--r--lib/libc/net/res_send.c12
4 files changed, 33 insertions, 33 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index dd85243..3a415dd 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -482,7 +482,7 @@ explore_fqdn(pai, hostname, servname, res)
s = socket(pai->ai_family, SOCK_DGRAM, 0);
if (s < 0)
return 0;
- close(s);
+ _libc_close(s);
/*
* if the servname does not match socktype/protocol, ignore it.
@@ -590,7 +590,7 @@ explore_null(pai, hostname, servname, res)
s = socket(pai->ai_family, SOCK_DGRAM, 0);
if (s < 0)
return 0;
- close(s);
+ _libc_close(s);
afd = find_afd(pai->ai_family);
if (afd == NULL)
return 0;
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 6683451..2f83d1c 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -257,7 +257,7 @@ _ghbyname(const char *name, int af, int flags, int *errp)
* (or apropriate interval),
* because addresses will be dynamically assigned or deleted.
*/
- close(s);
+ _libc_close(s);
}
for (i = 0; i < MAXHOSTCONF; i++) {
@@ -1182,21 +1182,21 @@ _icmp_fqdn_query(const struct in6_addr *addr, int ifindex)
(char *)&filter, sizeof(filter));
cc = sendmsg(s, &msg, 0);
if (cc < 0) {
- close(s);
+ _libc_close(s);
return NULL;
}
FD_SET(s, &s_fds);
for (;;) {
fds = s_fds;
if (select(s + 1, &fds, NULL, NULL, &tout) <= 0) {
- close(s);
+ _libc_close(s);
return NULL;
}
len = sizeof(sin6);
cc = recvfrom(s, buf, sizeof(buf), 0,
(struct sockaddr *)&sin6, &len);
if (cc <= 0) {
- close(s);
+ _libc_close(s);
return NULL;
}
if (cc < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
@@ -1207,7 +1207,7 @@ _icmp_fqdn_query(const struct in6_addr *addr, int ifindex)
if (fr->icmp6_fqdn_type == ICMP6_FQDN_REPLY)
break;
}
- close(s);
+ _libc_close(s);
if (fr->icmp6_fqdn_cookie[1] != 0) {
/* rfc1788 type */
name = buf + sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + 4;
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 0424a2a..7f68754 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -101,7 +101,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
sigsetmask(oldmask);
return (-1);
}
- fcntl(s, F_SETOWN, pid);
+ _libc_fcntl(s, F_SETOWN, pid);
bzero(&sin, sizeof sin);
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = hp->h_addrtype;
@@ -109,13 +109,13 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
bcopy(hp->h_addr_list[0], &sin.sin_addr, MIN(hp->h_length, sizeof sin.sin_addr));
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
- (void)close(s);
+ (void)_libc_close(s);
if (errno == EADDRINUSE) {
lport--;
continue;
}
if (errno == ECONNREFUSED && timo <= 16) {
- (void)sleep(timo);
+ (void)_libc_sleep(timo);
timo *= 2;
continue;
}
@@ -138,7 +138,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
}
lport--;
if (fd2p == 0) {
- write(s, "", 1);
+ _libc_write(s, "", 1);
lport = 0;
} else {
char num[8];
@@ -150,17 +150,17 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
goto bad;
listen(s2, 1);
(void)snprintf(num, sizeof(num), "%d", lport);
- if (write(s, num, strlen(num)+1) != strlen(num)+1) {
+ if (_libc_write(s, num, strlen(num)+1) != strlen(num)+1) {
(void)fprintf(stderr,
"rcmd: write (setting up stderr): %s\n",
strerror(errno));
- (void)close(s2);
+ (void)_libc_close(s2);
goto bad;
}
nfds = max(s, s2)+1;
if(nfds > FD_SETSIZE) {
fprintf(stderr, "rcmd: too many files\n");
- (void)close(s2);
+ (void)_libc_close(s2);
goto bad;
}
again:
@@ -176,7 +176,7 @@ again:
else
(void)fprintf(stderr,
"select: protocol failure in circuit setup\n");
- (void)close(s2);
+ (void)_libc_close(s2);
goto bad;
}
s3 = accept(s2, (struct sockaddr *)&from, &len);
@@ -185,10 +185,10 @@ again:
* down and check for the real auxiliary channel to connect.
*/
if (from.sin_family == AF_INET && from.sin_port == htons(20)) {
- close(s3);
+ _libc_close(s3);
goto again;
}
- (void)close(s2);
+ (void)_libc_close(s2);
if (s3 < 0) {
(void)fprintf(stderr,
"rcmd: accept: %s\n", strerror(errno));
@@ -205,17 +205,17 @@ again:
goto bad2;
}
}
- (void)write(s, locuser, strlen(locuser)+1);
- (void)write(s, remuser, strlen(remuser)+1);
- (void)write(s, cmd, strlen(cmd)+1);
- if (read(s, &c, 1) != 1) {
+ (void)_libc_write(s, locuser, strlen(locuser)+1);
+ (void)_libc_write(s, remuser, strlen(remuser)+1);
+ (void)_libc_write(s, cmd, strlen(cmd)+1);
+ if (_libc_read(s, &c, 1) != 1) {
(void)fprintf(stderr,
"rcmd: %s: %s\n", *ahost, strerror(errno));
goto bad2;
}
if (c != 0) {
- while (read(s, &c, 1) == 1) {
- (void)write(STDERR_FILENO, &c, 1);
+ while (_libc_read(s, &c, 1) == 1) {
+ (void)_libc_write(STDERR_FILENO, &c, 1);
if (c == '\n')
break;
}
@@ -225,9 +225,9 @@ again:
return (s);
bad2:
if (lport)
- (void)close(*fd2p);
+ (void)_libc_close(*fd2p);
bad:
- (void)close(s);
+ (void)_libc_close(s);
sigsetmask(oldmask);
return (-1);
}
@@ -251,13 +251,13 @@ rresvport(alport)
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
return (s);
if (errno != EADDRINUSE) {
- (void)close(s);
+ (void)_libc_close(s);
return (-1);
}
#endif
sin.sin_port = 0;
if (bindresvport(s, &sin) == -1) {
- (void)close(s);
+ (void)_libc_close(s);
return (-1);
}
*alport = (int)ntohs(sin.sin_port);
diff --git a/lib/libc/net/res_send.c b/lib/libc/net/res_send.c
index 15f2a13..b57b8db 100644
--- a/lib/libc/net/res_send.c
+++ b/lib/libc/net/res_send.c
@@ -428,7 +428,7 @@ res_send(buf, buflen, ans, anssiz)
read_len:
cp = ans;
len = INT16SZ;
- while ((n = read(s, (char *)cp, (int)len)) > 0) {
+ while ((n = _libc_read(s, (char *)cp, (int)len)) > 0) {
cp += n;
if ((len -= n) <= 0)
break;
@@ -476,7 +476,7 @@ read_len:
}
cp = ans;
while (len != 0 &&
- (n = read(s, (char *)cp, (int)len)) > 0) {
+ (n = _libc_read(s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
}
@@ -499,7 +499,7 @@ read_len:
n = (len > sizeof(junk)
? sizeof(junk)
: len);
- if ((n = read(s, junk, n)) > 0)
+ if ((n = _libc_read(s, junk, n)) > 0)
len -= n;
else
break;
@@ -607,8 +607,8 @@ read_len:
int s1 = socket(PF_INET, SOCK_DGRAM,0);
if (s1 < 0)
goto bad_dg_sock;
- (void) dup2(s1, s);
- (void) close(s1);
+ (void)dup2(s1, s);
+ (void)_libc_close(s1);
Dprint(_res.options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
#endif /* CAN_RECONNECT */
@@ -893,7 +893,7 @@ void
res_close()
{
if (s >= 0) {
- (void) close(s);
+ (void)_libc_close(s);
s = -1;
connected = 0;
vc = 0;
OpenPOWER on IntegriCloud