Hi,

I would like to reduce the warnings when arp, rarp, ndp are compiled
with WARNINGS=yes.  Let's start with this one.

warning: declaration of 'time' shadows a global declaration

No binary change.

ok?

bluhm

Index: usr.sbin/arp/arp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/arp/arp.c,v
retrieving revision 1.53
diff -u -p -r1.53 arp.c
--- usr.sbin/arp/arp.c  20 Jul 2013 18:21:11 -0000      1.53
+++ usr.sbin/arp/arp.c  14 Aug 2013 23:27:40 -0000
@@ -286,10 +286,10 @@ set(int argc, char *argv[])
        doing_proxy = flags = export_only = 0;
        while (argc-- > 0) {
                if (strncmp(argv[0], "temp", 4) == 0) {
-                       struct timeval time;
+                       struct timeval now;
 
-                       gettimeofday(&time, 0);
-                       expire_time = time.tv_sec + 20 * 60;
+                       gettimeofday(&now, 0);
+                       expire_time = now.tv_sec + 20 * 60;
                        if (flags & RTF_PERMANENT_ARP) {
                                /* temp or permanent, not both */
                                usage();
Index: usr.sbin/ndp/ndp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/ndp/ndp.c,v
retrieving revision 1.49
diff -u -p -r1.49 ndp.c
--- usr.sbin/ndp/ndp.c  9 Aug 2013 17:52:12 -0000       1.49
+++ usr.sbin/ndp/ndp.c  14 Aug 2013 23:29:52 -0000
@@ -382,10 +382,10 @@ set(int argc, char **argv)
        flags = 0;
        while (argc-- > 0) {
                if (strncmp(argv[0], "temp", 4) == 0) {
-                       struct timeval time;
+                       struct timeval now;
 
-                       gettimeofday(&time, 0);
-                       expire_time = time.tv_sec + 20 * 60;
+                       gettimeofday(&now, 0);
+                       expire_time = now.tv_sec + 20 * 60;
                } else if (strncmp(argv[0], "proxy", 5) == 0)
                        flags |= RTF_ANNOUNCE;
                argv++;
@@ -549,7 +549,7 @@ dump(struct in6_addr *addr, int cflag)
        struct sockaddr_in6 *sin;
        struct sockaddr_dl *sdl;
        struct in6_nbrinfo *nbi;
-       struct timeval time;
+       struct timeval now;
        int addrwidth;
        int llwidth;
        int ifwidth;
@@ -636,9 +636,9 @@ again:;
                                delete(host_buf);
                        continue;
                }
-               gettimeofday(&time, 0);
+               gettimeofday(&now, 0);
                if (tflag)
-                       ts_print(&time);
+                       ts_print(&now);
 
                addrwidth = strlen(host_buf);
                if (addrwidth < W_ADDR)
@@ -659,9 +659,9 @@ again:;
                /* Print neighbor discovery specific informations */
                nbi = getnbrinfo(&sin->sin6_addr, sdl->sdl_index, 1);
                if (nbi) {
-                       if (nbi->expire > time.tv_sec) {
+                       if (nbi->expire > now.tv_sec) {
                                printf(" %-9.9s",
-                                   sec2str(nbi->expire - time.tv_sec));
+                                   sec2str(nbi->expire - now.tv_sec));
                        } else if (nbi->expire == 0)
                                printf(" %-9.9s", "permanent");
                        else
@@ -956,7 +956,7 @@ rtrlist(void)
        char *buf;
        struct in6_defrouter *p, *ep;
        size_t l;
-       struct timeval time;
+       struct timeval now;
 
        if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) {
                err(1, "sysctl(ICMPV6CTL_ND6_DRLIST)");
@@ -991,12 +991,12 @@ rtrlist(void)
                rtpref = ((p->flags & ND_RA_FLAG_RTPREF_MASK) >> 3) & 0xff;
                printf(", pref=%s", rtpref_str[rtpref]);
 
-               gettimeofday(&time, 0);
+               gettimeofday(&now, 0);
                if (p->expire == 0)
                        printf(", expire=Never\n");
                else
                        printf(", expire=%s\n",
-                           sec2str(p->expire - time.tv_sec));
+                           sec2str(p->expire - now.tv_sec));
        }
        free(buf);
 }
@@ -1009,7 +1009,7 @@ plist(void)
        struct in6_prefix *p, *ep, *n;
        struct sockaddr_in6 *advrtr;
        size_t l;
-       struct timeval time;
+       struct timeval now;
        const int niflags = NI_NUMERICHOST;
        int ninflags = nflag ? NI_NUMERICHOST : 0;
        char namebuf[NI_MAXHOST];
@@ -1040,7 +1040,7 @@ plist(void)
                printf("%s/%d if=%s\n", namebuf, p->prefixlen,
                    if_indextoname(p->if_index, ifix_buf));
 
-               gettimeofday(&time, 0);
+               gettimeofday(&now, 0);
                /*
                 * meaning of fields, especially flags, is very different
                 * by origin.  notify the difference to the users.
@@ -1062,9 +1062,9 @@ plist(void)
                        printf(", pltime=%lu", (unsigned long)p->pltime);
                if (p->expire == 0)
                        printf(", expire=Never");
-               else if (p->expire >= time.tv_sec)
+               else if (p->expire >= now.tv_sec)
                        printf(", expire=%s",
-                           sec2str(p->expire - time.tv_sec));
+                           sec2str(p->expire - now.tv_sec));
                else
                        printf(", expired");
                printf(", ref=%d", p->refcnt);
Index: usr.sbin/rarpd/arptab.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/rarpd/arptab.c,v
retrieving revision 1.20
diff -u -p -r1.20 arptab.c
--- usr.sbin/rarpd/arptab.c     20 Jul 2013 18:25:34 -0000      1.20
+++ usr.sbin/rarpd/arptab.c     14 Aug 2013 23:28:09 -0000
@@ -96,7 +96,7 @@ arptab_set(u_char *eaddr, u_int32_t host
        struct sockaddr_inarp *sin = &sin_m;
        struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
        struct sockaddr_dl *sdl;
-       struct timeval time;
+       struct timeval now;
        int rt;
 
        getsocket();
@@ -109,8 +109,8 @@ arptab_set(u_char *eaddr, u_int32_t host
        sdl_m.sdl_alen = 6;
        expire_time = 0;
        doing_proxy = flags = export_only = 0;
-       gettimeofday(&time, 0);
-       expire_time = time.tv_sec + 20 * 60;
+       gettimeofday(&now, 0);
+       expire_time = now.tv_sec + 20 * 60;
 
 tryagain:
        if (rtmsg(RTM_GET) < 0) {

Reply via email to