From: jca Date: Sun, 31 Jul 2016 19:23:24 +0000 (+0000) Subject: Rename the route socket to a more useful name. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fa8923c45d8f54e2981a667d4b432a0e8fb67487;p=openbsd Rename the route socket to a more useful name. Avoid a bunch of "warning: declaration of 's' shadows a global declaration" while here. --- 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)