summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorericj <>2001-06-26 23:06:53 +0000
committerericj <>2001-06-26 23:06:53 +0000
commitf89ab44d3585f67a36bcc580baa9f20b9243f46c (patch)
tree2b56c954440b9f5985d078f3d0823de3ebae1b7d /src
parentf36a4af8154cedf09d0fa63c6e4285c59dad8b52 (diff)
downloadopenbsd-f89ab44d3585f67a36bcc580baa9f20b9243f46c.tar.gz
openbsd-f89ab44d3585f67a36bcc580baa9f20b9243f46c.tar.bz2
openbsd-f89ab44d3585f67a36bcc580baa9f20b9243f46c.zip
allow -k for udp and tcp
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/nc/netcat.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 70d98da2b1..36bb0f5e8c 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.26 2001/06/26 21:57:35 ericj Exp $ */ 1/* $OpenBSD: netcat.c,v 1.27 2001/06/26 23:06:53 ericj Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * 4 *
@@ -174,13 +174,12 @@ main(argc, argv)
174 174
175 if (lflag) { 175 if (lflag) {
176 int connfd; 176 int connfd;
177
178 if ((s = local_listen(host, uport, hints)) < 0)
179 errx(1, NULL);
180
181 ret = 0; 177 ret = 0;
178
182 /* Allow only one connection at a time, but stay alive */ 179 /* Allow only one connection at a time, but stay alive */
183 for (;;) { 180 for (;;) {
181 if ((s = local_listen(host, uport, hints)) < 0)
182 errx(1, NULL);
184 /* 183 /*
185 * For UDP, we will use recvfrom() initially 184 * For UDP, we will use recvfrom() initially
186 * to wait for a caller, then use the regular 185 * to wait for a caller, then use the regular
@@ -211,6 +210,8 @@ main(argc, argv)
211 210
212 readwrite(connfd); 211 readwrite(connfd);
213 close(connfd); 212 close(connfd);
213 close(s);
214
214 if (!kflag) 215 if (!kflag)
215 break; 216 break;
216 } 217 }