diff options
author | guenther <> | 2015-10-11 00:26:23 +0000 |
---|---|---|
committer | guenther <> | 2015-10-11 00:26:23 +0000 |
commit | 0df4e8b094152fd7db3f17c7045502f36a4116db (patch) | |
tree | 71b461a0d087e34099283a935c06cc97ba29e9bb /src | |
parent | edaaa7bf2f0b5ce874b24101100d02d3f3d0747f (diff) | |
download | openbsd-0df4e8b094152fd7db3f17c7045502f36a4116db.tar.gz openbsd-0df4e8b094152fd7db3f17c7045502f36a4116db.tar.bz2 openbsd-0df4e8b094152fd7db3f17c7045502f36a4116db.zip |
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@
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/nc/netcat.c | 11 |
1 files changed, 3 insertions, 8 deletions
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 @@ | |||
1 | /* $OpenBSD: netcat.c,v 1.138 2015/09/13 11:12:09 beck Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.139 2015/10/11 00:26:23 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
@@ -57,11 +57,6 @@ | |||
57 | #include <tls.h> | 57 | #include <tls.h> |
58 | #include "atomicio.h" | 58 | #include "atomicio.h" |
59 | 59 | ||
60 | #ifndef SUN_LEN | ||
61 | #define SUN_LEN(su) \ | ||
62 | (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) | ||
63 | #endif | ||
64 | |||
65 | #define PORT_MAX 65535 | 60 | #define PORT_MAX 65535 |
66 | #define PORT_MAX_LEN 6 | 61 | #define PORT_MAX_LEN 6 |
67 | #define UNIX_DG_TMP_SOCKET_SIZE 19 | 62 | #define UNIX_DG_TMP_SOCKET_SIZE 19 |
@@ -646,7 +641,7 @@ unix_bind(char *path, int flags) | |||
646 | return (-1); | 641 | return (-1); |
647 | } | 642 | } |
648 | 643 | ||
649 | if (bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { | 644 | if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) { |
650 | close(s); | 645 | close(s); |
651 | return (-1); | 646 | return (-1); |
652 | } | 647 | } |
@@ -741,7 +736,7 @@ unix_connect(char *path) | |||
741 | errno = ENAMETOOLONG; | 736 | errno = ENAMETOOLONG; |
742 | return (-1); | 737 | return (-1); |
743 | } | 738 | } |
744 | if (connect(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { | 739 | if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) { |
745 | close(s); | 740 | close(s); |
746 | return (-1); | 741 | return (-1); |
747 | } | 742 | } |