aboutsummaryrefslogtreecommitdiff
path: root/networking/nc_bloaty.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-25 13:16:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-25 13:16:53 +0000
commitf6b4685691ebe00f28e4f9148a1a255e87b8d312 (patch)
treef9445de4ac97a635d2fc8a9deeb29a892a0e81ba /networking/nc_bloaty.c
parent9ac3dc764a78b51fe8fdcd1b4682850de098733b (diff)
downloadbusybox-w32-f6b4685691ebe00f28e4f9148a1a255e87b8d312.tar.gz
busybox-w32-f6b4685691ebe00f28e4f9148a1a255e87b8d312.tar.bz2
busybox-w32-f6b4685691ebe00f28e4f9148a1a255e87b8d312.zip
add FEATURE_UNIX_LOCAL. By Ingo van Lil (inguin AT gmx.de)
Diffstat (limited to 'networking/nc_bloaty.c')
-rw-r--r--networking/nc_bloaty.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index efe831ec3..9aaeec100 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -377,9 +377,7 @@ create new one, and bind() it. TODO */
377 socklen_t x = sizeof(optbuf); 377 socklen_t x = sizeof(optbuf);
378 378
379 rr = getsockopt(netfd, IPPROTO_IP, IP_OPTIONS, optbuf, &x); 379 rr = getsockopt(netfd, IPPROTO_IP, IP_OPTIONS, optbuf, &x);
380 if (rr < 0) 380 if (rr >= 0 && x) { /* we've got options, lessee em... */
381 bb_perror_msg("getsockopt failed");
382 else if (x) { /* we've got options, lessee em... */
383 bin2hex(bigbuf_net, optbuf, x); 381 bin2hex(bigbuf_net, optbuf, x);
384 bigbuf_net[2*x] = '\0'; 382 bigbuf_net[2*x] = '\0';
385 fprintf(stderr, "IP options: %s\n", bigbuf_net); 383 fprintf(stderr, "IP options: %s\n", bigbuf_net);
@@ -603,7 +601,10 @@ Debug("got %d from the net, errno %d", rr, errno);
603 mobygrams are kinda fun and exercise the reassembler. */ 601 mobygrams are kinda fun and exercise the reassembler. */
604 if (rr <= 0) { /* at end, or fukt, or ... */ 602 if (rr <= 0) { /* at end, or fukt, or ... */
605 FD_CLR(STDIN_FILENO, &ding1); /* disable and close stdin */ 603 FD_CLR(STDIN_FILENO, &ding1); /* disable and close stdin */
606 close(0); 604 close(STDIN_FILENO);
605// Does it make sense to shutdown(net_fd, SHUT_WR)
606// to let other side know that we won't write anything anymore?
607// (and what about keeping compat if we do that?)
607 } else { 608 } else {
608 rzleft = rr; 609 rzleft = rr;
609 zp = bigbuf_in; 610 zp = bigbuf_in;
@@ -768,7 +769,12 @@ int nc_main(int argc, char **argv)
768 setsockopt_reuseaddr(netfd); 769 setsockopt_reuseaddr(netfd);
769 if (o_udpmode) 770 if (o_udpmode)
770 socket_want_pktinfo(netfd); 771 socket_want_pktinfo(netfd);
771 xbind(netfd, &ouraddr->u.sa, ouraddr->len); 772 if (!ENABLE_FEATURE_UNIX_LOCAL
773 || o_listen
774 || ouraddr->u.sa.sa_family != AF_UNIX
775 ) {
776 xbind(netfd, &ouraddr->u.sa, ouraddr->len);
777 }
772#if 0 778#if 0
773 setsockopt(netfd, SOL_SOCKET, SO_RCVBUF, &o_rcvbuf, sizeof o_rcvbuf); 779 setsockopt(netfd, SOL_SOCKET, SO_RCVBUF, &o_rcvbuf, sizeof o_rcvbuf);
774 setsockopt(netfd, SOL_SOCKET, SO_SNDBUF, &o_sndbuf, sizeof o_sndbuf); 780 setsockopt(netfd, SOL_SOCKET, SO_SNDBUF, &o_sndbuf, sizeof o_sndbuf);