summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko2008-03-17 09:04:04 +0000
committerDenis Vlasenko2008-03-17 09:04:04 +0000
commit85c247161b9e1e7c71ebcb874ed7b6a23b6a5b50 (patch)
tree0b60f25ea0ebfbac5d9b3fa22f123aadaecd6663 /networking
parent081eb71ebd7954a67287816a9a6fff80e8c5319a (diff)
downloadbusybox-85c247161b9e1e7c71ebcb874ed7b6a23b6a5b50.zip
busybox-85c247161b9e1e7c71ebcb874ed7b6a23b6a5b50.tar.gz
*: fix fallout from -Wunused-parameter
function old new delta bbunpack 358 366 +8 passwd_main 1070 1072 +2 handle_incoming_and_exit 2651 2653 +2 getpty 88 86 -2 script_main 975 972 -3 inetd_main 2036 2033 -3 dname_enc 377 373 -4 make_new_session 474 462 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/5 up/down: 12/-24) Total: -12 bytes text data bss dec hex filename 797429 658 7428 805515 c4a8b busybox_old 797417 658 7428 805503 c4a7f busybox_unstripped
Diffstat (limited to 'networking')
-rw-r--r--networking/Kbuild2
-rw-r--r--networking/ether-wake.c2
-rw-r--r--networking/httpd.c13
-rw-r--r--networking/ifupdown.c22
-rw-r--r--networking/inetd.c22
-rw-r--r--networking/nc.c2
-rw-r--r--networking/sendmail.c4
-rw-r--r--networking/telnetd.c4
-rw-r--r--networking/traceroute.c4
-rw-r--r--networking/udhcp/clientsocket.c2
-rw-r--r--networking/wget.c2
11 files changed, 57 insertions, 22 deletions
diff --git a/networking/Kbuild b/networking/Kbuild
index e06a124..44258e9 100644
--- a/networking/Kbuild
+++ b/networking/Kbuild
@@ -17,7 +17,7 @@ lib-$(CONFIG_FTPPUT) += ftpgetput.o
lib-$(CONFIG_HOSTNAME) += hostname.o
lib-$(CONFIG_HTTPD) += httpd.o
lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o
-lib-$(CONFIG_IFENSLAVE) += ifenslave.o
+lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o
lib-$(CONFIG_IFUPDOWN) += ifupdown.o
lib-$(CONFIG_INETD) += inetd.o
lib-$(CONFIG_IP) += ip.o
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index b752152..fcd7dd2 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -179,7 +179,7 @@ static int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd)
}
int ether_wake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int ether_wake_main(int argc, char **argv)
+int ether_wake_main(int argc ATTRIBUTE_UNUSED, char **argv)
{
const char *ifname = "eth0";
char *pass;
diff --git a/networking/httpd.c b/networking/httpd.c
index 54f288c..522e7ee 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1972,7 +1972,11 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
/* Try and do our best to parse more lines */
if ((STRNCASECMP(iobuf, "Content-length:") == 0)) {
/* extra read only for POST */
- if (prequest != request_GET && prequest != request_HEAD) {
+ if (prequest != request_GET
+#if ENABLE_FEATURE_HTTPD_CGI
+ && prequest != request_HEAD
+#endif
+ ) {
tptr = iobuf + sizeof("Content-length:") - 1;
if (!tptr[0])
send_headers_and_exit(HTTP_BAD_REQUEST);
@@ -2129,7 +2133,12 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
*/
send_file_and_exit(tptr,
- (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS));
+#if ENABLE_FEATURE_HTTPD_CGI
+ (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS)
+#else
+ SEND_HEADERS_AND_BODY
+#endif
+ );
}
/*
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 6aa929a..586c3db 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -483,9 +483,9 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
};
#endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */
+#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
{
-#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
int i;
#if ENABLE_FEATURE_IFUPDOWN_IP
/* ip doesn't up iface when it configures it (unlike ifconfig) */
@@ -498,7 +498,10 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
}
bb_error_msg("no dhcp clients found");
return 0;
+}
#elif ENABLE_APP_UDHCPC
+static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
+{
#if ENABLE_FEATURE_IFUPDOWN_IP
/* ip doesn't up iface when it configures it (unlike ifconfig) */
if (!execute("ip link set %iface% up", ifd, exec))
@@ -507,14 +510,18 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
ifd, exec);
+}
#else
+static int dhcp_up(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
+ execfn *exec ATTRIBUTE_UNUSED)
+{
return 0; /* no dhcp support */
-#endif
}
+#endif
+#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
{
-#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
int i;
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
if (exists_execable(ext_dhcp_clients[i].name))
@@ -522,13 +529,20 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
}
bb_error_msg("no dhcp clients found, using static interface shutdown");
return static_down(ifd, exec);
+}
#elif ENABLE_APP_UDHCPC
+static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
+{
return execute("kill "
"`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+}
#else
+static int dhcp_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
+ execfn *exec ATTRIBUTE_UNUSED)
+{
return 0; /* no dhcp support */
-#endif
}
+#endif
static int manual_up_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED, execfn *exec ATTRIBUTE_UNUSED)
{
diff --git a/networking/inetd.c b/networking/inetd.c
index 0ddfa6b..b931aa1 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1331,10 +1331,10 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
continue; /* -> check next fd in fd set */
}
- /* we are either child or didn't fork at all */
+ /* we are either child or didn't vfork at all */
#ifdef INETD_BUILTINS_ENABLED
if (sep->se_builtin) {
- if (pid) { /* "pid" is -1: we did fork */
+ if (pid) { /* "pid" is -1: we did vfork */
close(sep->se_fd); /* listening socket */
logmode = 0; /* make xwrite etc silent */
}
@@ -1343,8 +1343,8 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
sep->se_builtin->bi_stream_fn(ctrl, sep);
else
sep->se_builtin->bi_dgram_fn(ctrl, sep);
- if (pid) /* we did fork */
- _exit(0);
+ if (pid) /* we did vfork */
+ _exit(1);
maybe_close(accepted_fd);
continue; /* -> check next fd in fd set */
}
@@ -1430,11 +1430,15 @@ static void echo_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
xwrite(s, line, sz);
}
#else
+ /* We are after vfork here! */
static const char *const args[] = { "cat", NULL };
- /* no error messages */
+ /* move network socket to stdin */
+ xmove_fd(s, STDIN_FILENO);
+ xdup2(STDIN_FILENO, STDOUT_FILENO);
+ /* no error messages please... */
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
BB_EXECVP("cat", (char**)args);
- _exit(1);
+ /* on failure we return to main, which does exit(1) */
#endif
}
static void echo_dg(int s, servtab_t *sep)
@@ -1463,11 +1467,15 @@ static void discard_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
while (safe_read(s, line, LINE_SIZE) > 0)
continue;
#else
+ /* We are after vfork here! */
static const char *const args[] = { "dd", "of=/dev/null", NULL };
+ /* move network socket to stdin */
+ xmove_fd(s, STDIN_FILENO);
+ xdup2(STDIN_FILENO, STDOUT_FILENO);
/* no error messages */
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
BB_EXECVP("dd", (char**)args);
- _exit(1);
+ /* on failure we return to main, which does exit(1) */
#endif
}
/* ARGSUSED */
diff --git a/networking/nc.c b/networking/nc.c
index 7c2aafa..7d4a6e0 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -17,7 +17,7 @@
* when compared to "standard" nc
*/
-static void timeout(int signum)
+static void timeout(int signum ATTRIBUTE_UNUSED)
{
bb_error_msg_and_die("timed out");
}
diff --git a/networking/sendmail.c b/networking/sendmail.c
index 241028b..2eb01dc 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -551,11 +551,11 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
int rc;
// retrieve message in ./tmp/
- pop3_check(retr, (const char *)nmsg);
+ pop3_check(retr, (const char *)(ptrdiff_t)nmsg);
pop3_message(filename);
// delete message from server
if (opts & OPTF_z)
- pop3_check("DELE %u", (const char*)nmsg);
+ pop3_check("DELE %u", (const char*)(ptrdiff_t)nmsg);
// run postprocessing program
if (*fargs) {
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 20c5792..2ed3b74 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -161,14 +161,14 @@ make_new_session(
const char *login_argv[2];
struct termios termbuf;
int fd, pid;
- char tty_name[32];
+ char tty_name[GETPTY_BUFSIZE];
struct tsession *ts = xzalloc(sizeof(struct tsession) + BUFSIZE * 2);
/*ts->buf1 = (char *)(ts + 1);*/
/*ts->buf2 = ts->buf1 + BUFSIZE;*/
/* Got a new connection, set up a tty. */
- fd = getpty(tty_name, 32);
+ fd = getpty(tty_name);
if (fd < 0) {
bb_error_msg("can't create pty");
return NULL;
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 582840a..c0b4a3f 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -729,6 +729,10 @@ pr_type(unsigned char t)
}
#endif
+#if !ENABLE_FEATURE_TRACEROUTE_VERBOSE
+#define packet_ok(buf, cc, from, seq) \
+ packet_ok(buf, cc, seq)
+#endif
static int
packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
{
diff --git a/networking/udhcp/clientsocket.c b/networking/udhcp/clientsocket.c
index b5534f8..0be661d 100644
--- a/networking/udhcp/clientsocket.c
+++ b/networking/udhcp/clientsocket.c
@@ -76,7 +76,7 @@ int raw_socket(int ifindex)
BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0),
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, SERVER_AND_CLIENT_PORTS, 0, 1), /* L3, L4 */
/* returns */
- BPF_STMT(BPF_RET|BPF_K, ~0UL), /* L3: pass */
+ BPF_STMT(BPF_RET|BPF_K, (~(uint32_t)0) ), /* L3: pass */
BPF_STMT(BPF_RET|BPF_K, 0), /* L4: reject */
};
static const struct sock_fprog filter_prog = {
diff --git a/networking/wget.c b/networking/wget.c
index dc1dc2a..f8adcd7 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -189,7 +189,7 @@ static void progressmeter(int flag)
*/
#else /* FEATURE_WGET_STATUSBAR */
-static ALWAYS_INLINE void progressmeter(int flag) { }
+static ALWAYS_INLINE void progressmeter(int flag ATTRIBUTE_UNUSED) { }
#endif