From 39eb3f5ce4eec8df24e1ad015cf1c35f4853ec90 Mon Sep 17 00:00:00 2001 From: guenther Date: Mon, 19 Jan 2015 00:22:30 +0000 Subject: [PATCH] The kernel doesn't actually care what a sockaddr's sa_len is on input, so don't waste code setting it --- regress/sys/kern/accept/accept.c | 4 +--- regress/sys/kern/getpeereid/getpeereid_test.c | 3 +-- regress/sys/kern/unfdpass/unfdpass.c | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/regress/sys/kern/accept/accept.c b/regress/sys/kern/accept/accept.c index b59c349ffe1..2601fbb7e70 100644 --- a/regress/sys/kern/accept/accept.c +++ b/regress/sys/kern/accept/accept.c @@ -1,4 +1,4 @@ -/* $OpenBSD: accept.c,v 1.4 2004/02/28 03:29:15 deraadt Exp $ */ +/* $OpenBSD: accept.c,v 1.5 2015/01/19 00:22:30 guenther Exp $ */ /* * Written by Artur Grabowski , 2002 Public Domain. */ @@ -40,7 +40,6 @@ main(int argc, char *argv[]) memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_LOCAL; strlcpy(sun.sun_path, SOCK_NAME, sizeof sun.sun_path); - sun.sun_len = SUN_LEN(&sun); if (bind(listensock, (struct sockaddr *)&sun, sizeof(sun)) == -1) @@ -96,7 +95,6 @@ child() (void) memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_LOCAL; (void) strlcpy(sun.sun_path, SOCK_NAME, sizeof sun.sun_path); - sun.sun_len = SUN_LEN(&sun); if (connect(sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) err(1, "child connect"); diff --git a/regress/sys/kern/getpeereid/getpeereid_test.c b/regress/sys/kern/getpeereid/getpeereid_test.c index 70abbac8129..820ff2bcbca 100644 --- a/regress/sys/kern/getpeereid/getpeereid_test.c +++ b/regress/sys/kern/getpeereid/getpeereid_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getpeereid_test.c,v 1.2 2014/07/20 01:38:40 guenther Exp $ */ +/* $OpenBSD: getpeereid_test.c,v 1.3 2015/01/19 00:22:30 guenther Exp $ */ /* Written by Marc Espie in 2006 */ /* Public domain */ #include @@ -125,7 +125,6 @@ main() if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) errx(1, "Memory error"); - sun.sun_len = sizeof(sun); sun.sun_family = AF_UNIX; /* let's make those two rendez-vous, a bit artificial */ diff --git a/regress/sys/kern/unfdpass/unfdpass.c b/regress/sys/kern/unfdpass/unfdpass.c index fc0b13cfa31..22e909ce52b 100644 --- a/regress/sys/kern/unfdpass/unfdpass.c +++ b/regress/sys/kern/unfdpass/unfdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unfdpass.c,v 1.17 2011/07/06 19:48:10 matthew Exp $ */ +/* $OpenBSD: unfdpass.c,v 1.18 2015/01/19 00:22:30 guenther Exp $ */ /* $NetBSD: unfdpass.c,v 1.3 1998/06/24 23:51:30 thorpej Exp $ */ /*- @@ -120,7 +120,6 @@ main(int argc, char *argv[]) (void) memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_LOCAL; (void) strlcpy(sun.sun_path, SOCK_NAME, sizeof sun.sun_path); - sun.sun_len = SUN_LEN(&sun); if (bind(listensock, (struct sockaddr *)&sun, sizeof(sun)) == -1) err(1, "bind"); @@ -259,7 +258,6 @@ child(int sock, int type) (void) memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_LOCAL; (void) strlcpy(sun.sun_path, SOCK_NAME, sizeof sun.sun_path); - sun.sun_len = SUN_LEN(&sun); if (connect(sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) err(1, "child connect"); -- 2.20.1