introduce and use xdup2(int, int)
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is) remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions sockaddr2str 142 156 +14 collect_blk 467 474 +7 xdup2 28 33 +5 singlemount 4456 4454 -2 print_host 214 212 -2 nslookup_main 139 137 -2 ftpgetput_main 414 412 -2 udhcpd_main 1258 1255 -3 udhcpc_main 2405 2402 -3 traceroute_main 4125 4122 -3 nc_main 1072 1069 -3 buffer_fill_and_print 76 73 -3 xmalloc_sockaddr2hostonly_noport 18 14 -4 xmalloc_sockaddr2host_noport 18 14 -4 xmalloc_sockaddr2host 15 11 -4 xmalloc_sockaddr2dotted_noport 18 14 -4 xmalloc_sockaddr2dotted 18 14 -4 wget_main 2618 2614 -4 ping_main 393 389 -4 ip_port_str 120 115 -5 dhcprelay_main 1146 1141 -5 dnsd_main 1531 1525 -6 passwd_main 1110 1102 -8 udhcp_kernel_packet 206 197 -9 udhcp_listen_socket 154 144 -10 getty_main 2576 2566 -10 setup 655 640 -15 xmove_fd 51 34 -17 dolisten 759 742 -17 tcpudpsvd_main 1866 1836 -30 startservice 339 299 -40
This commit is contained in:
		@@ -278,7 +278,7 @@ static void dolisten(void)
 | 
			
		||||
		rr = getsockname(netfd, &ouraddr->sa, &ouraddr->len);
 | 
			
		||||
		if (rr < 0)
 | 
			
		||||
			bb_perror_msg_and_die("getsockname after bind");
 | 
			
		||||
		addr = xmalloc_sockaddr2dotted(&ouraddr->sa, ouraddr->len);
 | 
			
		||||
		addr = xmalloc_sockaddr2dotted(&ouraddr->sa);
 | 
			
		||||
		fprintf(stderr, "listening on %s ...\n", addr);
 | 
			
		||||
		free(addr);
 | 
			
		||||
	}
 | 
			
		||||
@@ -341,7 +341,7 @@ create new one, and bind() it. TODO */
 | 
			
		||||
				/* nc 1.10 bails out instead, and its error message
 | 
			
		||||
				 * is not suppressed by o_verbose */
 | 
			
		||||
				if (o_verbose) {
 | 
			
		||||
					char *remaddr = xmalloc_sockaddr2dotted(&remend.sa, remend.len);
 | 
			
		||||
					char *remaddr = xmalloc_sockaddr2dotted(&remend.sa);
 | 
			
		||||
					bb_error_msg("connect from wrong ip/port %s ignored", remaddr);
 | 
			
		||||
					free(remaddr);
 | 
			
		||||
				}
 | 
			
		||||
@@ -393,9 +393,9 @@ create new one, and bind() it. TODO */
 | 
			
		||||
	 accept the connection and then reject undesireable ones by closing.
 | 
			
		||||
	 In other words, we need a TCP MSG_PEEK. */
 | 
			
		||||
	/* bbox: removed most of it */
 | 
			
		||||
		lcladdr = xmalloc_sockaddr2dotted(&ouraddr->sa, ouraddr->len);
 | 
			
		||||
		remaddr = xmalloc_sockaddr2dotted(&remend.sa, remend.len);
 | 
			
		||||
		remhostname = o_nflag ? remaddr : xmalloc_sockaddr2host(&remend.sa, remend.len);
 | 
			
		||||
		lcladdr = xmalloc_sockaddr2dotted(&ouraddr->sa);
 | 
			
		||||
		remaddr = xmalloc_sockaddr2dotted(&remend.sa);
 | 
			
		||||
		remhostname = o_nflag ? remaddr : xmalloc_sockaddr2host(&remend.sa);
 | 
			
		||||
		fprintf(stderr, "connect to %s from %s (%s)\n",
 | 
			
		||||
				lcladdr, remhostname, remaddr);
 | 
			
		||||
		free(lcladdr);
 | 
			
		||||
@@ -796,7 +796,7 @@ int nc_main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
		remend = *themaddr;
 | 
			
		||||
		if (o_verbose)
 | 
			
		||||
			themdotted = xmalloc_sockaddr2dotted(&themaddr->sa, themaddr->len);
 | 
			
		||||
			themdotted = xmalloc_sockaddr2dotted(&themaddr->sa);
 | 
			
		||||
 | 
			
		||||
		x = connect_w_timeout(netfd);
 | 
			
		||||
		if (o_zero && x == 0 && o_udpmode)        /* if UDP scanning... */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user