From 0df4e8b094152fd7db3f17c7045502f36a4116db Mon Sep 17 00:00:00 2001 From: guenther <> Date: Sun, 11 Oct 2015 00:26:23 +0000 Subject: Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept sizeof(struct sockaddr_un), so do the simple, portable thing ok beck@ deraadt@ --- src/usr.bin/nc/netcat.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index ff9d3989d3..9fc825b5d8 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.138 2015/09/13 11:12:09 beck Exp $ */ +/* $OpenBSD: netcat.c,v 1.139 2015/10/11 00:26:23 guenther Exp $ */ /* * Copyright (c) 2001 Eric Jackson * Copyright (c) 2015 Bob Beck. All rights reserved. @@ -57,11 +57,6 @@ #include #include "atomicio.h" -#ifndef SUN_LEN -#define SUN_LEN(su) \ - (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) -#endif - #define PORT_MAX 65535 #define PORT_MAX_LEN 6 #define UNIX_DG_TMP_SOCKET_SIZE 19 @@ -646,7 +641,7 @@ unix_bind(char *path, int flags) return (-1); } - if (bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { + if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) { close(s); return (-1); } @@ -741,7 +736,7 @@ unix_connect(char *path) errno = ENAMETOOLONG; return (-1); } - if (connect(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { + if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) { close(s); return (-1); } -- cgit v1.2.3-55-g6feb