diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-02-09 22:55:46 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-02-09 22:55:46 +0000 |
commit | fe0eb99c792ace8b110742ceb0421e81dcc0980f (patch) | |
tree | 06d1b47efe5434ccc082fd9df97547b1e54f7f49 /usr.bin/nc/netcat.c | |
parent | a2da62a21bd92086a772d0787045020090d55249 (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.c | 7 |
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; |