diff options
Diffstat (limited to '')
| -rw-r--r-- | src/usr.bin/nc/netcat.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index fb7ac6c69c..deef3d18a6 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.13 2000/09/26 05:03:31 ericj Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.14 2000/09/26 05:16:00 ericj Exp $ */ |
| 2 | 2 | ||
| 3 | /* Netcat 1.10 RELEASE 960320 | 3 | /* Netcat 1.10 RELEASE 960320 |
| 4 | * | 4 | * |
| @@ -487,21 +487,21 @@ doconnect(rad, rp, lad, lp) | |||
| 487 | struct in_addr *lad; | 487 | struct in_addr *lad; |
| 488 | u_short lp; | 488 | u_short lp; |
| 489 | { | 489 | { |
| 490 | int nnetfd; | 490 | int nnetfd = 0; |
| 491 | int rr; | 491 | int rr; |
| 492 | int x, y; | 492 | int x, y; |
| 493 | errno = 0; | 493 | errno = 0; |
| 494 | 494 | ||
| 495 | /* grab a socket; set opts */ | 495 | /* grab a socket; set opts */ |
| 496 | newskt: | 496 | while (nnetfd == 0) { |
| 497 | if (o_udpmode) | 497 | if (o_udpmode) |
| 498 | nnetfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | 498 | nnetfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); |
| 499 | else | 499 | else |
| 500 | nnetfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | 500 | nnetfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| 501 | if (nnetfd < 0) | 501 | if (nnetfd < 0) |
| 502 | nlog(1, "Can't get socket"); | 502 | nlog(1, "Can't get socket"); |
| 503 | if (nnetfd == 0) /* if stdin was closed this might *be* 0, */ | 503 | } |
| 504 | goto newskt; /* so grab another. See text for why... */ | 504 | |
| 505 | x = 1; | 505 | x = 1; |
| 506 | rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); | 506 | rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); |
| 507 | if (rr == -1) | 507 | if (rr == -1) |
| @@ -1365,21 +1365,21 @@ main(argc, argv) | |||
| 1365 | */ | 1365 | */ |
| 1366 | void | 1366 | void |
| 1367 | nlog(doexit, fmt) | 1367 | nlog(doexit, fmt) |
| 1368 | char *fmt; | 1368 | char *fmt; |
| 1369 | { | 1369 | { |
| 1370 | va_list args; | 1370 | va_list args; |
| 1371 | 1371 | ||
| 1372 | if (o_verbose || doexit) { | 1372 | if (o_verbose || doexit) { |
| 1373 | va_start(args, fmt); | 1373 | va_start(args, fmt); |
| 1374 | vfprintf(stderr, fmt, args); | 1374 | vfprintf(stderr, fmt, args); |
| 1375 | if (h_errno) | 1375 | if (h_errno) |
| 1376 | herror(NULL); | 1376 | herror(NULL); |
| 1377 | else | 1377 | else |
| 1378 | putc('\n', stderr); | 1378 | putc('\n', stderr); |
| 1379 | } | 1379 | } |
| 1380 | 1380 | ||
| 1381 | if (doexit) | 1381 | if (doexit) |
| 1382 | exit(1); | 1382 | exit(1); |
| 1383 | } | 1383 | } |
| 1384 | 1384 | ||
| 1385 | void | 1385 | void |
