source:
npl/overig/netcat_openbsd/patches/0010-serialized-handling-multiple-clients.patch
@
e013060
Last change on this file since e013060 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 1.6 KB |
-
netcat.c
From: Aron Xu <aron@debian.org> Date: Tue, 14 Feb 2012 23:02:00 +0800 Subject: serialized handling multiple clients --- netcat.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/netcat.c b/netcat.c index 56cc15e..bf9940f 100644
a b main(int argc, char *argv[]) 447 447 s = unix_bind(host); 448 448 else 449 449 s = unix_listen(host); 450 } 450 } else 451 s = local_listen(host, uport, hints); 452 if (s < 0) 453 err(1, NULL); 454 455 char* local; 456 if (family == AF_INET6) 457 local = ":::"; 458 else 459 local = "0.0.0.0"; 460 fprintf(stderr, "Listening on [%s] (family %d, port %d)\n", 461 host ?: local, 462 family, 463 *uport); 451 464 452 465 /* Allow only one connection at a time, but stay alive. */ 453 466 for (;;) { 454 if (family != AF_UNIX)455 s = local_listen(host, uport, hints);456 if (s < 0)457 err(1, NULL);458 467 459 char* local;460 if (family == AF_INET6 )461 local = "0.0.0.0";462 else if (family == AF_INET)463 local = ":::";464 else465 local = "unknown";466 fprintf(stderr, "Listening on [%s] (family %d, port %d)\n",467 host ?: local,468 family,469 *uport);470 468 /* 471 469 * For UDP, we will use recvfrom() initially 472 470 * to wait for a caller, then use the regular … … main(int argc, char *argv[]) 536 534 close(connfd); 537 535 } 538 536 539 if (family != AF_UNIX) 537 if (kflag) 538 continue; 539 if (family != AF_UNIX) { 540 540 close(s); 541 } 541 542 else if (uflag) { 542 543 if (connect(s, NULL, 0) < 0) 543 544 err(1, "connect"); 544 545 } 545 546 if (!kflag) 547 break; 546 break; 548 547 } 549 548 } else if (family == AF_UNIX) { 550 549 ret = 0;
Note: See TracBrowser
for help on using the repository browser.