summaryrefslogtreecommitdiff
path: root/usr.bin/nc/netcat.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-02-09 22:55:46 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-02-09 22:55:46 +0000
commitfe0eb99c792ace8b110742ceb0421e81dcc0980f (patch)
tree06d1b47efe5434ccc082fd9df97547b1e54f7f49 /usr.bin/nc/netcat.c
parenta2da62a21bd92086a772d0787045020090d55249 (diff)
When netcat was started with -Uz, the exit status was always 1. If
the unix connect is successful, let nc -z close the socket and exit with 0. OK jca@
Diffstat (limited to 'usr.bin/nc/netcat.c')
-rw-r--r--usr.bin/nc/netcat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index 653b61a2a71..4580356dfbf 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.176 2017/02/09 20:14:41 jca Exp $ */
+/* $OpenBSD: netcat.c,v 1.177 2017/02/09 22:55:45 bluhm Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -597,8 +597,9 @@ main(int argc, char *argv[])
} else if (family == AF_UNIX) {
ret = 0;
- if ((s = unix_connect(host)) > 0 && !zflag) {
- readwrite(s, NULL);
+ if ((s = unix_connect(host)) > 0) {
+ if (!zflag)
+ readwrite(s, NULL);
close(s);
} else
ret = 1;