Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/syslogd tidy/fix printing of paths from sockaddr_un



details:   https://anonhg.NetBSD.org/src/rev/bf8da3fa9c73
branches:  trunk
changeset: 810584:bf8da3fa9c73
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Sep 05 20:19:43 2015 +0000

description:
tidy/fix printing of paths from sockaddr_un

diffstat:

 usr.sbin/syslogd/syslogd.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r 44d761469b80 -r bf8da3fa9c73 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c        Sat Sep 05 20:01:21 2015 +0000
+++ b/usr.sbin/syslogd/syslogd.c        Sat Sep 05 20:19:43 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslogd.c,v 1.121 2015/02/10 20:38:15 christos Exp $   */
+/*     $NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $   */
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)syslogd.c  8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.121 2015/02/10 20:38:15 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -714,9 +714,11 @@
                return;
        }
 
+#define SUN_PATHLEN(su) \
+       ((su)->sun_len - (sizeof(*(su)) - sizeof((su)->sun_path)))
+
        DPRINTF((D_CALL|D_EVENT|D_NET), "Unix socket (%.*s) active (%d, %d %p)"
-               " with linebuf@%p, size %zu)\n", (int)(myname.sun_len
-               - sizeof(myname.sun_len) - sizeof(myname.sun_family)),
+               " with linebuf@%p, size %zu)\n", (int)SUN_PATHLEN(&myname),
                myname.sun_path, fd, event, ev, linebuf, linebufsize-1);
 
        sunlen = sizeof(fromunix);
@@ -727,7 +729,7 @@
                printline(LocalFQDN, linebuf, 0);
        } else if (rv < 0 && errno != EINTR) {
                logerror("recvfrom() unix `%.*s'",
-                       myname.sun_len, myname.sun_path);
+                       (int)SUN_PATHLEN(&myname), myname.sun_path);
        }
 }
 



Home | Main Index | Thread Index | Old Index