diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-06 22:05:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-06 22:05:23 +0000 |
commit | 6dbb1fbadfc0b9c64b1da80376fe45dc0ad61d0a (patch) | |
tree | 9d01e6b039c1733da9a1ca2bb5b2376433b01567 /libexec | |
parent | 3b4d2c34419058cd5dfbf1770ae7c3f9081c0c40 (diff) |
avoid variable aliasing
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/identd/identd.c | 14 | ||||
-rw-r--r-- | libexec/identd/openbsd.c | 18 | ||||
-rw-r--r-- | libexec/identd/parse.c | 16 |
3 files changed, 24 insertions, 24 deletions
diff --git a/libexec/identd/identd.c b/libexec/identd/identd.c index 1975832879b..fea1a295bc3 100644 --- a/libexec/identd/identd.c +++ b/libexec/identd/identd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: identd.c,v 1.41 2004/11/17 01:47:20 itojun Exp $ */ +/* $OpenBSD: identd.c,v 1.42 2005/12/06 22:05:22 deraadt Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -77,7 +77,7 @@ gethost4_addr(struct in_addr *addr) { struct hostent *hp; - hp = gethostbyaddr((char *) addr, sizeof(struct in_addr), AF_INET); + hp = gethostbyaddr(addr, sizeof(struct in_addr), AF_INET); if (hp) return hp->h_name; return inet_ntoa(*addr); @@ -96,7 +96,7 @@ gethost4(struct sockaddr_in *sin) { struct hostent *hp; - hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), AF_INET); + hp = gethostbyaddr(&sin->sin_addr, sizeof(struct in_addr), AF_INET); if (hp) return hp->h_name; return inet_ntoa(sin->sin_addr); @@ -111,13 +111,13 @@ gethost6(struct sockaddr_in6 *addr) static char hbuf[2][NI_MAXHOST]; const int niflags = NI_NUMERICHOST; static int bb = 0; - int error; + int err; bb = (bb+1)%2; - error = getnameinfo((struct sockaddr *)addr, addr->sin6_len, + err = getnameinfo((struct sockaddr *)addr, addr->sin6_len, hbuf[bb], sizeof(hbuf[bb]), NULL, 0, niflags); - if (error != 0) { - syslog(LOG_ERR, "getnameinfo failed (%s)", gai_strerror(error)); + if (err != 0) { + syslog(LOG_ERR, "getnameinfo failed (%s)", gai_strerror(err)); strlcpy(hbuf[bb], "UNKNOWN", sizeof(hbuf[bb])); } return(hbuf[bb]); diff --git a/libexec/identd/openbsd.c b/libexec/identd/openbsd.c index 46126aaec55..2d1d86c015f 100644 --- a/libexec/identd/openbsd.c +++ b/libexec/identd/openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openbsd.c,v 1.19 2004/09/16 08:25:05 deraadt Exp $ */ +/* $OpenBSD: openbsd.c,v 1.20 2005/12/06 22:05:22 deraadt Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -41,7 +41,7 @@ k_getuid(struct in_addr *faddr, int fport, struct in_addr *laddr, int mib[] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_IDENT }; struct sockaddr_in *fin, *lin; struct tcp_ident_mapping tir; - int error = 0; + int err = 0; size_t i; memset(&tir, 0, sizeof (tir)); @@ -57,12 +57,12 @@ k_getuid(struct in_addr *faddr, int fport, struct in_addr *laddr, fin->sin_port = fport; lin->sin_port = lport; i = sizeof (tir); - error = sysctl(mib, sizeof (mib) / sizeof (int), &tir, &i, NULL, 0); - if (!error && tir.ruid != -1) { + err = sysctl(mib, sizeof (mib) / sizeof (int), &tir, &i, NULL, 0); + if (!err && tir.ruid != -1) { *uid = tir.ruid; return (0); } - if (error == -1) + if (err == -1) syslog(LOG_DEBUG, "sysctl failed (%m)"); return (-1); @@ -79,7 +79,7 @@ k_getuid6(struct sockaddr_in6 *faddr, int fport, struct sockaddr_in6 *laddr, int mib[] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_IDENT }; struct sockaddr_in6 *fin, *lin; struct tcp_ident_mapping tir; - int error = 0; + int err = 0; size_t i; memset(&tir, 0, sizeof (tir)); @@ -95,12 +95,12 @@ k_getuid6(struct sockaddr_in6 *faddr, int fport, struct sockaddr_in6 *laddr, fin->sin6_port = fport; lin->sin6_port = lport; i = sizeof (tir); - error = sysctl(mib, sizeof (mib) / sizeof (int), &tir, &i, NULL, 0); - if (!error && tir.ruid != -1) { + err = sysctl(mib, sizeof (mib) / sizeof (int), &tir, &i, NULL, 0); + if (!err && tir.ruid != -1) { *uid = tir.ruid; return (0); } - if (error == -1) + if (err == -1) syslog(LOG_DEBUG, "sysctl failed (%m)"); return (-1); diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c index c488bd015ab..7bb9d094e21 100644 --- a/libexec/identd/parse.c +++ b/libexec/identd/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.42 2005/04/04 08:55:36 deraadt Exp $ */ +/* $OpenBSD: parse.c,v 1.43 2005/12/06 22:05:22 deraadt Exp $ */ /* * This program is in the public domain and may be used freely by anyone @@ -120,7 +120,7 @@ ssize_t timed_read(int fd, void *buf, size_t siz, time_t timeout) { struct timeval tv, start, after, duration, tmp; - int error, tot = 0, i, r; + int err, tot = 0, i, r; struct pollfd rfd[1]; char *p = buf; @@ -133,9 +133,9 @@ timed_read(int fd, void *buf, size_t siz, time_t timeout) rfd[0].revents = 0; gettimeofday(&start, NULL); - if ((error = poll(rfd, 1, tv.tv_sec * 1000 + + if ((err = poll(rfd, 1, tv.tv_sec * 1000 + tv.tv_usec / 1000)) <= 0) - return error; + return err; r = read(fd, p, siz - tot); if (r == -1 || r == 0) return (r); @@ -163,7 +163,7 @@ timed_write(int fd, const void *buf, size_t siz, time_t timeout) { struct pollfd wfd[2]; struct timeval tv; - int error; + int err; wfd[0].fd = fd; wfd[0].events = POLLOUT; @@ -172,10 +172,10 @@ timed_write(int fd, const void *buf, size_t siz, time_t timeout) tv.tv_sec = timeout; tv.tv_usec = 0; - if ((error = poll(wfd, 1, tv.tv_sec * 1000 + + if ((err = poll(wfd, 1, tv.tv_sec * 1000 + tv.tv_usec / 1000)) <= 0) - return error; - return(write(fd, buf, siz)); + return err; + return (write(fd, buf, siz)); } int |