Date: Wed, 4 Dec 2013 20:07:35 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258937 - head/sbin/route Message-ID: <201312042007.rB4K7ZSX064771@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Wed Dec 4 20:07:34 2013 New Revision: 258937 URL: http://svnweb.freebsd.org/changeset/base/258937 Log: route(1): Pull static variable out of the function and into function scope. This will make it easier to link as a library. Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de> (older version) Discussed on: -hackers Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Wed Dec 4 20:05:20 2013 (r258936) +++ head/sbin/route/route.c Wed Dec 4 20:07:34 2013 (r258937) @@ -95,6 +95,7 @@ static int defaultfib; static int numfibs; static char domain[MAXHOSTNAMELEN + 1]; static bool domain_initialized; +static int rtm_seq; static int atalk_aton(const char *, struct at_addr *); static char *atalk_ntoa(struct at_addr, char [ATALK_BUF_SIZE]); @@ -1490,7 +1491,6 @@ static struct { static int rtmsg(int cmd, int flags, int fib) { - static int seq; int rlen; char *cp = m_rtmsg.m_space; int l; @@ -1526,7 +1526,7 @@ rtmsg(int cmd, int flags, int fib) rtm.rtm_type = cmd; rtm.rtm_flags = flags; rtm.rtm_version = RTM_VERSION; - rtm.rtm_seq = ++seq; + rtm.rtm_seq = ++rtm_seq; rtm.rtm_addrs = rtm_addrs; rtm.rtm_rmx = rt_metrics; rtm.rtm_inits = rtm_inits; @@ -1551,7 +1551,7 @@ rtmsg(int cmd, int flags, int fib) if (cmd == RTM_GET) { do { l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg)); - } while (l > 0 && (rtm.rtm_seq != seq || rtm.rtm_pid != pid)); + } while (l > 0 && (rtm.rtm_seq != rtm_seq || rtm.rtm_pid != pid)); if (l < 0) warn("read from routing socket"); else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312042007.rB4K7ZSX064771>