summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ndp
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2016-07-31 19:23:24 +0000
committerjca <jca@openbsd.org>2016-07-31 19:23:24 +0000
commitfa8923c45d8f54e2981a667d4b432a0e8fb67487 (patch)
treedddbb5a5f29407ee6c5f332c14a96cefd02ebce4 /usr.sbin/ndp
parentTurn two global variables into variables local to main. (diff)
downloadwireguard-openbsd-fa8923c45d8f54e2981a667d4b432a0e8fb67487.tar.xz
wireguard-openbsd-fa8923c45d8f54e2981a667d4b432a0e8fb67487.zip
Rename the route socket to a more useful name.
Avoid a bunch of "warning: declaration of 's' shadows a global declaration" while here.
Diffstat (limited to 'usr.sbin/ndp')
-rw-r--r--usr.sbin/ndp/ndp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 47d7db83c10..cef46bbd74f 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ndp.c,v 1.73 2016/07/31 19:17:41 jca Exp $ */
+/* $OpenBSD: ndp.c,v 1.74 2016/07/31 19:23:24 jca Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
@@ -116,7 +116,7 @@ static pid_t pid;
static int nflag;
static int tflag;
static int32_t thiszone; /* time difference with gmt */
-static int s = -1;
+static int rtsock = -1;
static int repeat = 0;
char ntop_buf[INET6_ADDRSTRLEN]; /* inet_ntop() */
@@ -334,9 +334,9 @@ file(char *name)
void
getsocket(void)
{
- if (s < 0) {
- s = socket(PF_ROUTE, SOCK_RAW, 0);
- if (s < 0) {
+ if (rtsock < 0) {
+ rtsock = socket(PF_ROUTE, SOCK_RAW, 0);
+ if (rtsock < 0) {
err(1, "socket");
/* NOTREACHED */
}
@@ -857,14 +857,14 @@ doit:
l = rtm->rtm_msglen;
rtm->rtm_seq = ++seq;
rtm->rtm_type = cmd;
- if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) {
+ if ((rlen = write(rtsock, (char *)&m_rtmsg, l)) < 0) {
if (errno != ESRCH || cmd != RTM_DELETE) {
err(1, "writing to routing socket");
/* NOTREACHED */
}
}
do {
- l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
+ l = read(rtsock, (char *)&m_rtmsg, sizeof(m_rtmsg));
} while (l > 0 && (rtm->rtm_version != RTM_VERSION ||
rtm->rtm_seq != seq || rtm->rtm_pid != pid));
if (l < 0)