aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-09-26 00:19:13 +0000
committerXin LI <delphij@FreeBSD.org>2015-09-26 00:19:13 +0000
commit70061f65353c351c2a0712f76d3e29a0164ce1dc (patch)
tree347aff099a83083aef81109e2b2030871f2e6983
parent9911c7eeca0337f27d3d0ff146b9481d9cc385ef (diff)
downloadsrc-70061f65353c351c2a0712f76d3e29a0164ce1dc.tar.gz
src-70061f65353c351c2a0712f76d3e29a0164ce1dc.zip
Vendor import nc(1) from OPENBSD_5_8.vendor/netcat/5.8
Notes
Notes: svn path=/vendor/netcat/dist/; revision=288243 svn path=/vendor/netcat/5.8/; revision=288244; tag=vendor/netcat/5.8
-rw-r--r--nc.16
-rw-r--r--netcat.c16
-rw-r--r--socks.c6
3 files changed, 15 insertions, 13 deletions
diff --git a/nc.1 b/nc.1
index 109cc299db60..d57a02e28767 100644
--- a/nc.1
+++ b/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.
@@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: February 10 2014 $
+.Dd $Mdocdate: February 26 2014 $
.Dt NC 1
.Os
.Sh NAME
@@ -115,7 +115,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/netcat.c b/netcat.c
index ce7fde45259d..6358539418d5 100644
--- a/netcat.c
+++ b/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>
*
@@ -44,15 +44,16 @@
#include <err.h>
#include <errno.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
@@ -141,6 +142,8 @@ main(int argc, char *argv[])
uport = NULL;
sv = NULL;
+ signal(SIGPIPE, SIG_IGN);
+
while ((ch = getopt(argc, argv,
"46DdFhI:i:klNnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) {
switch (ch) {
@@ -746,7 +749,7 @@ readwrite(int net_fd)
size_t netinbufpos = 0;
unsigned char stdinbuf[BUFSIZE];
size_t stdinbufpos = 0;
- int n, num_fds, flags;
+ int n, num_fds;
ssize_t ret;
/* don't read from stdin if requested */
@@ -980,7 +983,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);
@@ -997,17 +999,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/socks.c b/socks.c
index f8adda463a22..1b06e0e12dd5 100644
--- a/socks.c
+++ b/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));