diff options
Diffstat (limited to 'src/usr.bin/nc/netcat.c')
| -rw-r--r-- | src/usr.bin/nc/netcat.c | 11 |
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 | } |
