summaryrefslogtreecommitdiff
path: root/usr.bin/nc/netcat.c
diff options
context:
space:
mode:
authorEric Jackson <ericj@cvs.openbsd.org>2002-03-10 20:26:10 +0000
committerEric Jackson <ericj@cvs.openbsd.org>2002-03-10 20:26:10 +0000
commite784849fe476fca12377b05133bd7eb2be455152 (patch)
tree779202573020d4ebba3e3b9d565b4c38debec6bc /usr.bin/nc/netcat.c
parent0678a64e9390fdd4603e5ddec7ea44ac402b0957 (diff)
check that we got the port before trying to listen
pr 2436; Alexander Yurchenko <grange@rt.mipt.ru>
Diffstat (limited to 'usr.bin/nc/netcat.c')
-rw-r--r--usr.bin/nc/netcat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index dc4fe9e37d4..da57c3239ac 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.46 2002/02/28 18:05:36 markus Exp $ */
+/* $OpenBSD: netcat.c,v 1.47 2002/03/10 20:26:09 ericj Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
*
@@ -512,7 +512,7 @@ local_listen(char *host, char *port, struct addrinfo hints)
s = -1;
} while ((res0 = res0->ai_next) != NULL);
- if (!uflag) {
+ if (!uflag && s != -1) {
if (listen(s, 1) < 0)
errx(1, "%s", strerror(errno));
}