Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/rtadvd Use %m in syslog(3) instead of %s strerror(3).



details:   https://anonhg.NetBSD.org/src/rev/dd4f111f18f0
branches:  trunk
changeset: 338712:dd4f111f18f0
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Jun 05 15:41:59 2015 +0000

description:
Use %m in syslog(3) instead of %s strerror(3).

diffstat:

 usr.sbin/rtadvd/advcap.c |   5 +--
 usr.sbin/rtadvd/if.c     |   5 +--
 usr.sbin/rtadvd/rrenum.c |  14 ++++--------
 usr.sbin/rtadvd/rtadvd.c |  49 ++++++++++++++++++-----------------------------
 4 files changed, 28 insertions(+), 45 deletions(-)

diffs (235 lines):

diff -r 28193e0e1896 -r dd4f111f18f0 usr.sbin/rtadvd/advcap.c
--- a/usr.sbin/rtadvd/advcap.c  Fri Jun 05 14:15:41 2015 +0000
+++ b/usr.sbin/rtadvd/advcap.c  Fri Jun 05 15:41:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advcap.c,v 1.14 2012/12/13 15:36:35 roy Exp $  */
+/*     $NetBSD: advcap.c,v 1.15 2015/06/05 15:41:59 roy Exp $  */
 /*     $KAME: advcap.c,v 1.11 2003/05/19 09:46:50 keiichi Exp $        */
 
 /*
@@ -136,8 +136,7 @@
                tf = open(RM = cp, O_RDONLY);
        }
        if (tf < 0) {
-               syslog(LOG_INFO,
-                      "<%s> open: %s", __func__, strerror(errno));
+               syslog(LOG_INFO, "<%s> open: %m", __func__);
                return (-2);
        }
        for (;;) {
diff -r 28193e0e1896 -r dd4f111f18f0 usr.sbin/rtadvd/if.c
--- a/usr.sbin/rtadvd/if.c      Fri Jun 05 14:15:41 2015 +0000
+++ b/usr.sbin/rtadvd/if.c      Fri Jun 05 15:41:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.22 2012/12/13 15:36:36 roy Exp $      */
+/*     $NetBSD: if.c,v 1.23 2015/06/05 15:41:59 roy Exp $      */
 /*     $KAME: if.c,v 1.36 2004/11/30 22:32:01 suz Exp $        */
 
 /*
@@ -134,8 +134,7 @@
        int s;
 
        if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
-               syslog(LOG_ERR, "<%s> socket: %s", __func__,
-                      strerror(errno));
+               syslog(LOG_ERR, "<%s> socket: %m", __func__);
                return (oifflags & ~IFF_UP);
        }
 
diff -r 28193e0e1896 -r dd4f111f18f0 usr.sbin/rtadvd/rrenum.c
--- a/usr.sbin/rtadvd/rrenum.c  Fri Jun 05 14:15:41 2015 +0000
+++ b/usr.sbin/rtadvd/rrenum.c  Fri Jun 05 15:41:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rrenum.c,v 1.17 2015/06/05 14:09:20 roy Exp $  */
+/*     $NetBSD: rrenum.c,v 1.18 2015/06/05 15:41:59 roy Exp $  */
 /*     $KAME: rrenum.c,v 1.14 2004/06/14 05:36:00 itojun Exp $ */
 
 /*
@@ -165,8 +165,7 @@
                irr->irr_useprefix.sin6_addr = in6addr_any;
                if (ioctl(s, rrcmd2pco[rpm->rpm_code], irr) < 0 &&
                    errno != EADDRNOTAVAIL)
-                       syslog(LOG_ERR, "<%s> ioctl: %s", __func__,
-                              strerror(errno));
+                       syslog(LOG_ERR, "<%s> ioctl: %m", __func__);
                return;
        }
 
@@ -197,8 +196,7 @@
 
                if (ioctl(s, rrcmd2pco[rpm->rpm_code], irr) < 0 &&
                    errno != EADDRNOTAVAIL)
-                       syslog(LOG_ERR, "<%s> ioctl: %s", __func__,
-                              strerror(errno));
+                       syslog(LOG_ERR, "<%s> ioctl: %m", __func__);
 
                /* very adhoc: should be rewritten */
                if (rpm->rpm_code == RPM_PCO_CHANGE &&
@@ -252,8 +250,7 @@
                return 1;
 
        if (s == -1 && (s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
-               syslog(LOG_ERR, "<%s> socket: %s", __func__,
-                      strerror(errno));
+               syslog(LOG_ERR, "<%s> socket: %m", __func__);
                exit(1);
        }
 
@@ -283,8 +280,7 @@
        if (errno == ENXIO)
                return 0;
        else if (errno) {
-               syslog(LOG_ERR, "<%s> if_indextoname: %s", __func__,
-                      strerror(errno));
+               syslog(LOG_ERR, "<%s> if_indextoname: %m", __func__);
                return 1;
        }
        return 0;
diff -r 28193e0e1896 -r dd4f111f18f0 usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c  Fri Jun 05 14:15:41 2015 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c  Fri Jun 05 15:41:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtadvd.c,v 1.48 2015/06/05 14:15:41 roy Exp $  */
+/*     $NetBSD: rtadvd.c,v 1.49 2015/06/05 15:41:59 roy Exp $  */
 /*     $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $    */
 
 /*
@@ -336,8 +336,7 @@
                {
                        /* EINTR would occur upon SIGUSR1 for status dump */
                        if (errno != EINTR)
-                               syslog(LOG_ERR, "<%s> poll: %s",
-                                   __func__, strerror(errno));
+                               syslog(LOG_ERR, "<%s> poll: %m", __func__);
                        continue;
                }
                if (i == 0)     /* timeout */
@@ -1500,7 +1499,7 @@
                                CMSG_SPACE(sizeof(int));
        rcvcmsgbuf = malloc(rcvcmsgbuflen);
        if (rcvcmsgbuf == NULL) {
-               syslog(LOG_ERR, "<%s> not enough core", __func__);
+               syslog(LOG_ERR, "<%s> malloc: %m", __func__);
                exit(1);
        }
 
@@ -1508,13 +1507,12 @@
                                CMSG_SPACE(sizeof(int));
        sndcmsgbuf = malloc(sndcmsgbuflen);
        if (sndcmsgbuf == NULL) {
-               syslog(LOG_ERR, "<%s> not enough core", __func__);
+               syslog(LOG_ERR, "<%s> malloc: %m", __func__);
                exit(1);
        }
 
        if ((sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) {
-               syslog(LOG_ERR, "<%s> socket: %s", __func__,
-                      strerror(errno));
+               syslog(LOG_ERR, "<%s> socket: %m", __func__);
                exit(1);
        }
 
@@ -1531,15 +1529,13 @@
 #ifdef IPV6_RECVPKTINFO
        if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
                       sizeof(on)) < 0) {
-               syslog(LOG_ERR, "<%s> IPV6_RECVPKTINFO: %s",
-                      __func__, strerror(errno));
+               syslog(LOG_ERR, "<%s> IPV6_RECVPKTINFO: %m", __func__);
                exit(1);
        }
 #else  /* old adv. API */
        if (setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
                       sizeof(on)) < 0) {
-               syslog(LOG_ERR, "<%s> IPV6_PKTINFO: %s",
-                      __func__, strerror(errno));
+               syslog(LOG_ERR, "<%s> IPV6_PKTINFO: %m", __func__);
                exit(1);
        }
 #endif 
@@ -1549,15 +1545,13 @@
 #ifdef IPV6_RECVHOPLIMIT
        if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on,
                       sizeof(on)) < 0) {
-               syslog(LOG_ERR, "<%s> IPV6_RECVHOPLIMIT: %s",
-                      __func__, strerror(errno));
+               syslog(LOG_ERR, "<%s> IPV6_RECVHOPLIMIT: %m", __func__);
                exit(1);
        }
 #else  /* old adv. API */
        if (setsockopt(sock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on,
                       sizeof(on)) < 0) {
-               syslog(LOG_ERR, "<%s> IPV6_HOPLIMIT: %s",
-                      __func__, strerror(errno));
+               syslog(LOG_ERR, "<%s> IPV6_HOPLIMIT: %m", __func__);
                exit(1);
        }
 #endif
@@ -1569,8 +1563,7 @@
                ICMP6_FILTER_SETPASS(ICMP6_ROUTER_RENUMBERING, &filt);
        if (setsockopt(sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filt,
                       sizeof(filt)) < 0) {
-               syslog(LOG_ERR, "<%s> IICMP6_FILTER: %s",
-                      __func__, strerror(errno));
+               syslog(LOG_ERR, "<%s> IICMP6_FILTER: %m", __func__);
                exit(1);
        }
 
@@ -1588,8 +1581,8 @@
                mreq.ipv6mr_interface = ra->ifindex;
                if (setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq,
                               sizeof(mreq)) < 0) {
-                       syslog(LOG_ERR, "<%s> IPV6_JOIN_GROUP(link) on %s: %s",
-                              __func__, ra->ifname, strerror(errno));
+                       syslog(LOG_ERR, "<%s> IPV6_JOIN_GROUP(link) on %s: %m",
+                              __func__, ra->ifname);
                        exit(1);
                }
        }
@@ -1620,10 +1613,9 @@
                if (setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
                               &mreq, sizeof(mreq)) < 0) {
                        syslog(LOG_ERR,
-                              "<%s> IPV6_JOIN_GROUP(site) on %s: %s",
+                              "<%s> IPV6_JOIN_GROUP(site) on %s: %m",
                               __func__,
-                              mcastif ? mcastif : ra->ifname,
-                              strerror(errno));
+                              mcastif ? mcastif : ra->ifname);
                        exit(1);
                }
        }
@@ -1653,8 +1645,7 @@
 rtsock_open(void)
 {
        if ((rtsock = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) {
-               syslog(LOG_ERR,
-                      "<%s> socket: %s", __func__, strerror(errno));
+               syslog(LOG_ERR, "<%s> socket: %m", __func__);
                exit(1);
        }
 }
@@ -1709,9 +1700,8 @@
 
        if (i < 0 || (size_t)i != rai->ra_datalen)  {
                if (i < 0) {
-                       syslog(LOG_ERR, "<%s> sendmsg on %s: %s",
-                              __func__, rai->ifname,
-                              strerror(errno));
+                       syslog(LOG_ERR, "<%s> sendmsg on %s: %m",
+                              __func__, rai->ifname);
                }
        }
 
@@ -1727,9 +1717,8 @@
                if (i < 0 || i != rai->ra_datalen)  {
                        if (i < 0) {
                                syslog(LOG_ERR,
-                                   "<%s> unicast sendmsg on %s: %s",
-                                   __func__, rai->ifname,
-                                   strerror(errno));
+                                   "<%s> unicast sendmsg on %s: %m",
+                                   __func__, rai->ifname);
                        }
                }
 #endif



Home | Main Index | Thread Index | Old Index