cp: -r and -R imply -d (coreutils compat)
[oweals/busybox.git] / ipsvd / tcpudp.c
index 553fee870d63b5dfeff4c7d9feb2149ef7500d54..6a11539c7a3c3a26c8515a23f53c58a8c773759b 100644 (file)
@@ -32,7 +32,7 @@
 #include <limits.h>
 #include <linux/netfilter_ipv4.h> /* wants <limits.h> */
 
-#include "busybox.h"
+#include "libbb.h"
 #include "ipsvd_perhost.h"
 
 #ifdef SSLSVD
@@ -98,7 +98,7 @@ enum {
 
 static void connection_status(void)
 {
-       /* "only 1 client max" don't need this */
+       /* "only 1 client max" desn't need this */
        if (cmax > 1)
                printf("%s: info: status %u/%u\n", applet_name, cnum, cmax);
 }
@@ -150,14 +150,14 @@ int tcpudpsvd_main(int argc, char **argv)
        tcp = (applet_name[0] == 't');
 
        /* 3+ args, -i at most once, -p implies -h, -v is counter */
-       opt_complementary = "-3:?:i--i:ph:vv";
+       opt_complementary = "-3:i--i:ph:vv";
 #ifdef SSLSVD
-       getopt32(argc, argv, "+c:C:i:x:u:l:Eb:hpt:vU:/:Z:K:",
+       getopt32(argv, "+c:C:i:x:u:l:Eb:hpt:vU:/:Z:K:",
                &str_c, &str_C, &instructs, &instructs, &user, &local_hostname,
                &str_b, &str_t, &ssluser, &root, &cert, &key, &verbose
        );
 #else
-       getopt32(argc, argv, "+c:C:i:x:u:l:Eb:hpt:v",
+       getopt32(argv, "+c:C:i:x:u:l:Eb:hpt:v",
                &str_c, &str_C, &instructs, &instructs, &user, &local_hostname,
                &str_b, &str_t, &verbose
        );
@@ -258,7 +258,7 @@ int tcpudpsvd_main(int argc, char **argv)
 #endif
 
        if (verbose) {
-               char *addr = xmalloc_sockaddr2dotted(&lsa->sa, sa_len);
+               char *addr = xmalloc_sockaddr2dotted(&lsa->sa);
                printf("%s: info: listening on %s", applet_name, addr);
                free(addr);
 #ifndef SSLSVD
@@ -302,7 +302,7 @@ int tcpudpsvd_main(int argc, char **argv)
        if (max_per_host) {
                /* Drop connection immediately if cur_per_host > max_per_host
                 * (minimizing load under SYN flood) */
-               remote_ip = xmalloc_sockaddr2dotted_noport(&remote.sa, sa_len);
+               remote_ip = xmalloc_sockaddr2dotted_noport(&remote.sa);
                cur_per_host = ipsvd_perhost_add(remote_ip, max_per_host, &hccp);
                if (cur_per_host > max_per_host) {
                        /* ipsvd_perhost_add detected that max is exceeded
@@ -341,7 +341,7 @@ int tcpudpsvd_main(int argc, char **argv)
                 * we cannot replace fd #0 - we will lose pending packet
                 * which is already buffered for us! And we cannot use fd #1
                 * instead - it will "intercept" all following packets, but child
-                * do not expect data coming *from fd #1*! */
+                * does not expect data coming *from fd #1*! */
 #if 0
                /* Make it so that local addr is fixed to localp->sa
                 * and we don't accidentally accept packets to other local IPs. */
@@ -380,11 +380,11 @@ int tcpudpsvd_main(int argc, char **argv)
                close(sock);
 
        if (need_remote_ip)
-               remote_addr = xmalloc_sockaddr2dotted(&remote.sa, sa_len);
+               remote_addr = xmalloc_sockaddr2dotted(&remote.sa);
 
        if (need_hostnames) {
                if (option_mask32 & OPT_h) {
-                       remote_hostname = xmalloc_sockaddr2host_noport(&remote.sa, sa_len);
+                       remote_hostname = xmalloc_sockaddr2host_noport(&remote.sa);
                        if (!remote_hostname) {
                                bb_error_msg("warning: cannot look up hostname for %s", remote_addr);
                                remote_hostname = (char*)"";
@@ -397,9 +397,9 @@ int tcpudpsvd_main(int argc, char **argv)
                        local.len = sa_len;
                        getsockname(0, &local.sa, &local.len);
                }
-               local_addr = xmalloc_sockaddr2dotted(&local.sa, sa_len);
+               local_addr = xmalloc_sockaddr2dotted(&local.sa);
                if (!local_hostname) {
-                       local_hostname = xmalloc_sockaddr2host_noport(&local.sa, sa_len);
+                       local_hostname = xmalloc_sockaddr2host_noport(&local.sa);
                        if (!local_hostname)
                                bb_error_msg_and_die("warning: cannot look up hostname for %s"+9, local_addr);
                }
@@ -426,7 +426,7 @@ int tcpudpsvd_main(int argc, char **argv)
                 * an outbond connection to local handler, and it needs
                 * to know where it originally tried to connect */
                if (tcp && getsockopt(0, SOL_IP, SO_ORIGINAL_DST, &lsa->sa, &lsa->len) == 0) {
-                       char *addr = xmalloc_sockaddr2dotted(&lsa->sa, sa_len);
+                       char *addr = xmalloc_sockaddr2dotted(&lsa->sa);
                        xsetenv("TCPORIGDSTADDR", addr);
                        free(addr);
                }