diff options
author | bluhm <> | 2017-02-09 22:55:45 +0000 |
---|---|---|
committer | bluhm <> | 2017-02-09 22:55:45 +0000 |
commit | 8268fe790c86c379912aa8d5cbf05a25fdcbba1e (patch) | |
tree | 2693a2ccac7793cd9b3d817f9aa1ec87558c2a3a /src | |
parent | 7e978d03227f2fbd6f056f832132d35de01fb4b8 (diff) | |
download | openbsd-8268fe790c86c379912aa8d5cbf05a25fdcbba1e.tar.gz openbsd-8268fe790c86c379912aa8d5cbf05a25fdcbba1e.tar.bz2 openbsd-8268fe790c86c379912aa8d5cbf05a25fdcbba1e.zip |
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 'src')
-rw-r--r-- | src/usr.bin/nc/netcat.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 653b61a2a7..4580356dfb 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: netcat.c,v 1.176 2017/02/09 20:14:41 jca Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.177 2017/02/09 22:55:45 bluhm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
@@ -597,8 +597,9 @@ main(int argc, char *argv[]) | |||
597 | } else if (family == AF_UNIX) { | 597 | } else if (family == AF_UNIX) { |
598 | ret = 0; | 598 | ret = 0; |
599 | 599 | ||
600 | if ((s = unix_connect(host)) > 0 && !zflag) { | 600 | if ((s = unix_connect(host)) > 0) { |
601 | readwrite(s, NULL); | 601 | if (!zflag) |
602 | readwrite(s, NULL); | ||
602 | close(s); | 603 | close(s); |
603 | } else | 604 | } else |
604 | ret = 1; | 605 | ret = 1; |