diff options
author | ericj <> | 2000-09-26 02:51:22 +0000 |
---|---|---|
committer | ericj <> | 2000-09-26 02:51:22 +0000 |
commit | 72f9493edc2b3c0e1077f33e79ba8f7c74bc9894 (patch) | |
tree | a841983d1981be43b00a7a43f4aa1e142124f48c /src/usr.bin | |
parent | 8607102888fca2a9d8698bbc4ddc4ad1c3b2a54e (diff) | |
download | openbsd-72f9493edc2b3c0e1077f33e79ba8f7c74bc9894.tar.gz openbsd-72f9493edc2b3c0e1077f33e79ba8f7c74bc9894.tar.bz2 openbsd-72f9493edc2b3c0e1077f33e79ba8f7c74bc9894.zip |
some warnings should only be shown with -v
Diffstat (limited to 'src/usr.bin')
-rw-r--r-- | src/usr.bin/nc/netcat.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index ae9d4d9df1..ad0b5bf149 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.11 2000/09/26 01:15:49 ericj Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.12 2000/09/26 02:51:22 ericj Exp $ */ |
2 | 2 | ||
3 | /* Netcat 1.10 RELEASE 960320 | 3 | /* Netcat 1.10 RELEASE 960320 |
4 | * | 4 | * |
@@ -511,7 +511,7 @@ newskt: | |||
511 | x = 1; | 511 | x = 1; |
512 | rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); | 512 | rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); |
513 | if (rr == -1) | 513 | if (rr == -1) |
514 | warn("nnetfd reuseaddr failed"); /* ??? */ | 514 | errx(1, NULL); |
515 | 515 | ||
516 | /* fill in all the right sockaddr crud */ | 516 | /* fill in all the right sockaddr crud */ |
517 | lclend->sin_family = AF_INET; | 517 | lclend->sin_family = AF_INET; |
@@ -620,7 +620,7 @@ dolisten(rad, rp, lad, lp) | |||
620 | strcat(bigbuf_net, "any"); | 620 | strcat(bigbuf_net, "any"); |
621 | strcat(bigbuf_net, "] %d ..."); | 621 | strcat(bigbuf_net, "] %d ..."); |
622 | z = ntohs(lclend->sin_port); | 622 | z = ntohs(lclend->sin_port); |
623 | warn(bigbuf_net, z); | 623 | warn("%s %d", bigbuf_net, z); |
624 | } /* verbose -- whew!! */ | 624 | } /* verbose -- whew!! */ |
625 | /* | 625 | /* |
626 | * UDP is a speeeeecial case -- we have to do I/O *and* get the | 626 | * UDP is a speeeeecial case -- we have to do I/O *and* get the |
@@ -670,7 +670,7 @@ whoisit: | |||
670 | cp = &bigbuf_net[32]; | 670 | cp = &bigbuf_net[32]; |
671 | x = sizeof(struct sockaddr); | 671 | x = sizeof(struct sockaddr); |
672 | rr = getsockname(nnetfd, (struct sockaddr *) lclend, &x); | 672 | rr = getsockname(nnetfd, (struct sockaddr *) lclend, &x); |
673 | if (rr < 0) | 673 | if (rr < 0 && o_verbose) |
674 | warn("post-rcv getsockname failed"); | 674 | warn("post-rcv getsockname failed"); |
675 | strcpy(cp, inet_ntoa(lclend->sin_addr)); | 675 | strcpy(cp, inet_ntoa(lclend->sin_addr)); |
676 | 676 | ||
@@ -691,8 +691,10 @@ whoisit: | |||
691 | errx(1, "invalid connection to [%s] from %s [%s] %d", | 691 | errx(1, "invalid connection to [%s] from %s [%s] %d", |
692 | cp, whozis->name, whozis->addrs[0], z); | 692 | cp, whozis->name, whozis->addrs[0], z); |
693 | } | 693 | } |
694 | warn("connect to [%s] from %s [%s] %d", | 694 | if (o_verbose) { |
695 | cp, whozis->name, whozis->addrs[0], z); | 695 | warn("connect to [%s] from %s [%s] %d", |
696 | cp, whozis->name, whozis->addrs[0], z); | ||
697 | } | ||
696 | return (nnetfd); | 698 | return (nnetfd); |
697 | 699 | ||
698 | dol_tmo: | 700 | dol_tmo: |
@@ -721,7 +723,7 @@ udptest(fd, where) | |||
721 | int rr; | 723 | int rr; |
722 | 724 | ||
723 | rr = write(fd, bigbuf_in, 1); | 725 | rr = write(fd, bigbuf_in, 1); |
724 | if (rr != 1) | 726 | if (rr != 1 && o_verbose) |
725 | warn("udptest first write failed?! errno %d", errno); | 727 | warn("udptest first write failed?! errno %d", errno); |
726 | if (o_wait) | 728 | if (o_wait) |
727 | sleep(o_wait); | 729 | sleep(o_wait); |
@@ -966,7 +968,7 @@ readwrite(fd) | |||
966 | netretry--; /* we actually try a coupla | 968 | netretry--; /* we actually try a coupla |
967 | * times. */ | 969 | * times. */ |
968 | if (!netretry) { | 970 | if (!netretry) { |
969 | if (o_verbose > 1) /* normally we don't | 971 | if (o_verbose) /* normally we don't |
970 | * care */ | 972 | * care */ |
971 | warn("net timeout"); | 973 | warn("net timeout"); |
972 | close(fd); | 974 | close(fd); |
@@ -1018,7 +1020,6 @@ readwrite(fd) | |||
1018 | shovel: | 1020 | shovel: |
1019 | /* sanity check. Works because they're both unsigned... */ | 1021 | /* sanity check. Works because they're both unsigned... */ |
1020 | if ((rzleft > 8200) || (rnleft > 8200)) { | 1022 | if ((rzleft > 8200) || (rnleft > 8200)) { |
1021 | warn("Bogus buffers: %d, %d", rzleft, rnleft); | ||
1022 | rzleft = rnleft = 0; | 1023 | rzleft = rnleft = 0; |
1023 | } | 1024 | } |
1024 | /* net write retries sometimes happen on UDP connections */ | 1025 | /* net write retries sometimes happen on UDP connections */ |
@@ -1279,7 +1280,7 @@ main(argc, argv) | |||
1279 | netfd = dolisten(themaddr, curport, ouraddr, o_lport); | 1280 | netfd = dolisten(themaddr, curport, ouraddr, o_lport); |
1280 | if (netfd > 0) { | 1281 | if (netfd > 0) { |
1281 | x = readwrite(netfd); | 1282 | x = readwrite(netfd); |
1282 | if (o_verbose > 1) | 1283 | if (o_verbose) |
1283 | warn("Sent %i Rcvd %i", wrote_net, wrote_out); | 1284 | warn("Sent %i Rcvd %i", wrote_net, wrote_out); |
1284 | exit(x); | 1285 | exit(x); |
1285 | } else | 1286 | } else |