summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2016-07-31 19:23:25 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2016-07-31 19:23:25 +0000
commita1e4f51f999e338d0bd5d43f70f496a9357e28d9 (patch)
treec638f21e4255f710bc90fbbac1a0d863aae6aa30
parent59890c28fdebe47ac9a427197d736318fb49faa2 (diff)
Rename the route socket to a more useful name.
Avoid a bunch of "warning: declaration of 's' shadows a global declaration" while here.
-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)