From fe0eb99c792ace8b110742ceb0421e81dcc0980f Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Thu, 9 Feb 2017 22:55:46 +0000 Subject: 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@ --- usr.bin/nc/netcat.c | 7 ++++--- 1 file 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 * 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; -- cgit v1.2.3