aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-09-27 07:04:16 +0000
committerXin LI <delphij@FreeBSD.org>2015-09-27 07:04:16 +0000
commit100e2a06e24307b89188b4363280136e30044cea (patch)
tree450a15fe1949c7cdb4a2e9eab6a065c1c2f01672
parent1558cb2448a18565379c8991e5191f5fc0479e68 (diff)
parent70061f65353c351c2a0712f76d3e29a0164ce1dc (diff)
downloadsrc-100e2a06e24307b89188b4363280136e30044cea.tar.gz
src-100e2a06e24307b89188b4363280136e30044cea.zip
MFV r288243: nc from OpenBSD 5.8.
Notes
Notes: svn path=/head/; revision=288303
-rw-r--r--contrib/netcat/nc.16
-rw-r--r--contrib/netcat/netcat.c14
-rw-r--r--contrib/netcat/socks.c6
3 files changed, 14 insertions, 12 deletions
diff --git a/contrib/netcat/nc.1 b/contrib/netcat/nc.1
index e1f4c2dabc6b..7e7b9fd1ed62 100644
--- a/contrib/netcat/nc.1
+++ b/contrib/netcat/nc.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: nc.1,v 1.67 2014/02/26 20:56:11 claudio Exp $
+.\" $OpenBSD: nc.1,v 1.68 2015/03/26 10:35:04 tobias Exp $
.\"
.\" Copyright (c) 1996 David Sacerdote
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 11, 2014
+.Dd September 26, 2015
.Dt NC 1
.Os
.Sh NAME
@@ -133,7 +133,7 @@ connection to another program (e.g.\&
.Xr ssh 1
using the
.Xr ssh_config 5
-.Cm ProxyUseFdPass
+.Cm ProxyUseFdpass
option).
.It Fl h
Prints out
diff --git a/contrib/netcat/netcat.c b/contrib/netcat/netcat.c
index 041fff8bd856..04e31e8a5c0c 100644
--- a/contrib/netcat/netcat.c
+++ b/contrib/netcat/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.127 2015/02/14 22:40:22 jca Exp $ */
+/* $OpenBSD: netcat.c,v 1.130 2015/07/26 19:12:28 chl Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
*
@@ -52,15 +52,16 @@
#include <err.h>
#include <errno.h>
#include <getopt.h>
+#include <fcntl.h>
+#include <limits.h>
#include <netdb.h>
#include <poll.h>
+#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
#include "atomicio.h"
#ifndef SUN_LEN
@@ -163,6 +164,8 @@ main(int argc, char *argv[])
uport = NULL;
sv = NULL;
+ signal(SIGPIPE, SIG_IGN);
+
while ((ch = getopt_long(argc, argv,
"46DdEe:FhI:i:klNnoO:P:p:rSs:tT:UuV:vw:X:x:z",
longopts, NULL)) != -1) {
@@ -1042,7 +1045,6 @@ fdpass(int nfd)
bzero(&mh, sizeof(mh));
bzero(&cmsgbuf, sizeof(cmsgbuf));
bzero(&iov, sizeof(iov));
- bzero(&pfd, sizeof(pfd));
mh.msg_control = (caddr_t)&cmsgbuf.buf;
mh.msg_controllen = sizeof(cmsgbuf.buf);
@@ -1059,17 +1061,17 @@ fdpass(int nfd)
bzero(&pfd, sizeof(pfd));
pfd.fd = STDOUT_FILENO;
+ pfd.events = POLLOUT;
for (;;) {
r = sendmsg(STDOUT_FILENO, &mh, 0);
if (r == -1) {
if (errno == EAGAIN || errno == EINTR) {
- pfd.events = POLLOUT;
if (poll(&pfd, 1, -1) == -1)
err(1, "poll");
continue;
}
err(1, "sendmsg");
- } else if (r == -1)
+ } else if (r != 1)
errx(1, "sendmsg: unexpected return value %zd", r);
else
break;
diff --git a/contrib/netcat/socks.c b/contrib/netcat/socks.c
index f8adda463a22..1b06e0e12dd5 100644
--- a/contrib/netcat/socks.c
+++ b/contrib/netcat/socks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: socks.c,v 1.20 2012/03/08 09:56:28 espie Exp $ */
+/* $OpenBSD: socks.c,v 1.21 2015/03/26 21:19:51 tobias Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -308,8 +308,8 @@ socks_connect(const char *host, const char *port,
}
/* Terminate headers */
- if ((r = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2)
- err(1, "write failed (2/%d)", r);
+ if ((cnt = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2)
+ err(1, "write failed (%zu/2)", cnt);
/* Read status reply */
proxy_read_line(proxyfd, buf, sizeof(buf));