mirror of
https://github.com/sheumann/hush.git
synced 2024-08-21 11:28:57 +00:00
*: 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
This commit is contained in:
parent
081eb71ebd
commit
85c247161b
@ -11,8 +11,8 @@
|
|||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
|
|
||||||
#if ENABLE_BUILD_LIBBUSYBOX
|
#if ENABLE_BUILD_LIBBUSYBOX
|
||||||
int main(int argc, char **argv)
|
int main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||||
{
|
{
|
||||||
return lbb_main(argc, argv);
|
return lbb_main(argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,7 +141,7 @@ char* make_new_name_bzip2(char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int bzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int bzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int bzip2_main(int argc, char **argv)
|
int bzip2_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||||
{
|
{
|
||||||
unsigned opt;
|
unsigned opt;
|
||||||
|
|
||||||
|
@ -2026,7 +2026,11 @@ USE_DESKTOP(long long) int pack_gzip(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
|
#if ENABLE_GUNZIP
|
||||||
int gzip_main(int argc, char **argv)
|
int gzip_main(int argc, char **argv)
|
||||||
|
#else
|
||||||
|
int gzip_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
unsigned opt;
|
unsigned opt;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ int reset_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
|||||||
#if ENABLE_STTY
|
#if ENABLE_STTY
|
||||||
return stty_main(2, (char**)args);
|
return stty_main(2, (char**)args);
|
||||||
#else
|
#else
|
||||||
execvp("stty", args);
|
execvp("stty", (char**)args);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -21,6 +21,12 @@
|
|||||||
#define OPT_DEREFERENCE (1 << 2)
|
#define OPT_DEREFERENCE (1 << 2)
|
||||||
#define OPT_SELINUX (1 << 3)
|
#define OPT_SELINUX (1 << 3)
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_STAT_FORMAT
|
||||||
|
typedef bool (*statfunc_ptr)(const char *, const char *);
|
||||||
|
#else
|
||||||
|
typedef bool (*statfunc_ptr)(const char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *file_type(const struct stat *st)
|
static const char *file_type(const struct stat *st)
|
||||||
{
|
{
|
||||||
/* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
|
/* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
|
||||||
@ -338,8 +344,14 @@ static void print_it(const char *masterformat, const char *filename,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Stat the file system and print what we find. */
|
/* Stat the file system and print what we find. */
|
||||||
|
#if !ENABLE_FEATURE_STAT_FORMAT
|
||||||
|
#define do_statfs(filename, format) do_statfs(filename)
|
||||||
|
#endif
|
||||||
static bool do_statfs(const char *filename, const char *format)
|
static bool do_statfs(const char *filename, const char *format)
|
||||||
{
|
{
|
||||||
|
#if !ENABLE_FEATURE_STAT_FORMAT
|
||||||
|
const char *format;
|
||||||
|
#endif
|
||||||
struct statfs statfsbuf;
|
struct statfs statfsbuf;
|
||||||
#if ENABLE_SELINUX
|
#if ENABLE_SELINUX
|
||||||
security_context_t scontext = NULL;
|
security_context_t scontext = NULL;
|
||||||
@ -447,6 +459,9 @@ static bool do_statfs(const char *filename, const char *format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stat the file and print what we find */
|
/* stat the file and print what we find */
|
||||||
|
#if !ENABLE_FEATURE_STAT_FORMAT
|
||||||
|
#define do_stat(filename, format) do_stat(filename)
|
||||||
|
#endif
|
||||||
static bool do_stat(const char *filename, const char *format)
|
static bool do_stat(const char *filename, const char *format)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@ -612,10 +627,10 @@ static bool do_stat(const char *filename, const char *format)
|
|||||||
int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int stat_main(int argc, char **argv)
|
int stat_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *format = NULL;
|
USE_FEATURE_STAT_FORMAT(char *format = NULL;)
|
||||||
int i;
|
int i;
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
bool (*statfunc)(const char *, const char *) = do_stat;
|
statfunc_ptr statfunc = do_stat;
|
||||||
|
|
||||||
getopt32(argv, "ftL"
|
getopt32(argv, "ftL"
|
||||||
USE_SELINUX("Z")
|
USE_SELINUX("Z")
|
||||||
@ -633,7 +648,7 @@ int stat_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif /* ENABLE_SELINUX */
|
#endif /* ENABLE_SELINUX */
|
||||||
for (i = optind; i < argc; ++i)
|
for (i = optind; i < argc; ++i)
|
||||||
ok &= statfunc(argv[i], format);
|
ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format));
|
||||||
|
|
||||||
return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,10 @@ ACTF(context)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int fileAction(const char *fileName, struct stat *statbuf, void *userData, int depth)
|
static int fileAction(const char *fileName,
|
||||||
|
struct stat *statbuf,
|
||||||
|
void *userData SKIP_FEATURE_FIND_MAXDEPTH(ATTRIBUTE_UNUSED),
|
||||||
|
int depth SKIP_FEATURE_FIND_MAXDEPTH(ATTRIBUTE_UNUSED))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if ENABLE_FEATURE_FIND_MAXDEPTH
|
#if ENABLE_FEATURE_FIND_MAXDEPTH
|
||||||
|
@ -64,9 +64,9 @@ void lbb_prepare(const char *applet
|
|||||||
) MAIN_EXTERNALLY_VISIBLE;
|
) MAIN_EXTERNALLY_VISIBLE;
|
||||||
#if ENABLE_BUILD_LIBBUSYBOX
|
#if ENABLE_BUILD_LIBBUSYBOX
|
||||||
#if ENABLE_FEATURE_SHARED_BUSYBOX
|
#if ENABLE_FEATURE_SHARED_BUSYBOX
|
||||||
int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE;
|
int lbb_main(char **argv) EXTERNALLY_VISIBLE;
|
||||||
#else
|
#else
|
||||||
int lbb_main(int argc, char **argv);
|
int lbb_main(char **argv);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -237,7 +237,8 @@ extern int recursive_action(const char *fileName, unsigned flags,
|
|||||||
int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
|
int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
|
||||||
void* userData, unsigned depth);
|
void* userData, unsigned depth);
|
||||||
extern int device_open(const char *device, int mode);
|
extern int device_open(const char *device, int mode);
|
||||||
extern int getpty(char *line, int size);
|
enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
|
||||||
|
extern int getpty(char *line);
|
||||||
extern int get_console_fd(void);
|
extern int get_console_fd(void);
|
||||||
extern char *find_block_device(const char *path);
|
extern char *find_block_device(const char *path);
|
||||||
/* bb_copyfd_XX print read/write errors and return -1 if they occur */
|
/* bb_copyfd_XX print read/write errors and return -1 if they occur */
|
||||||
|
@ -989,6 +989,7 @@
|
|||||||
""
|
""
|
||||||
#define false_full_usage \
|
#define false_full_usage \
|
||||||
"Return an exit code of FALSE (1)"
|
"Return an exit code of FALSE (1)"
|
||||||
|
|
||||||
#define false_example_usage \
|
#define false_example_usage \
|
||||||
"$ false\n" \
|
"$ false\n" \
|
||||||
"$ echo $?\n" \
|
"$ echo $?\n" \
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int halt_main(int argc, char **argv)
|
int halt_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||||
{
|
{
|
||||||
static const int magic[] = {
|
static const int magic[] = {
|
||||||
#ifdef RB_HALT_SYSTEM
|
#ifdef RB_HALT_SYSTEM
|
||||||
|
@ -661,7 +661,7 @@ void run_applet_and_exit(const char *name, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
#if ENABLE_BUILD_LIBBUSYBOX
|
#if ENABLE_BUILD_LIBBUSYBOX
|
||||||
int lbb_main(int argc, char **argv)
|
int lbb_main(char **argv)
|
||||||
#else
|
#else
|
||||||
int main(int argc ATTRIBUTE_UNUSED, char **argv)
|
int main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
int getpty(char *line, int size)
|
#define DEBUG 0
|
||||||
|
|
||||||
|
int getpty(char *line)
|
||||||
{
|
{
|
||||||
int p;
|
int p;
|
||||||
#if ENABLE_FEATURE_DEVPTS
|
#if ENABLE_FEATURE_DEVPTS
|
||||||
@ -24,7 +26,7 @@ int getpty(char *line, int size)
|
|||||||
bb_perror_msg("ptsname error (is /dev/pts mounted?)");
|
bb_perror_msg("ptsname error (is /dev/pts mounted?)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
safe_strncpy(line, name, size);
|
safe_strncpy(line, name, GETPTY_BUFSIZE);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -294,7 +294,12 @@ static void redraw(int y, int back_cursor)
|
|||||||
|
|
||||||
/* Delete the char in front of the cursor, optionally saving it
|
/* Delete the char in front of the cursor, optionally saving it
|
||||||
* for later putback */
|
* for later putback */
|
||||||
|
#if !ENABLE_FEATURE_EDITING_VI
|
||||||
|
static void input_delete(void)
|
||||||
|
#define input_delete(save) input_delete()
|
||||||
|
#else
|
||||||
static void input_delete(int save)
|
static void input_delete(int save)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int j = cursor;
|
int j = cursor;
|
||||||
|
|
||||||
|
@ -130,9 +130,7 @@ static void die_if_nologin(void)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
} else
|
} else
|
||||||
puts("\r\nSystem closed for routine maintenance\r");
|
puts("\r\nSystem closed for routine maintenance\r");
|
||||||
if (!amroot)
|
|
||||||
exit(1);
|
exit(1);
|
||||||
puts("\r\n[Disconnect bypassed -- root login allowed]\r");
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static ALWAYS_INLINE void die_if_nologin(void) {}
|
static ALWAYS_INLINE void die_if_nologin(void) {}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "bbconfigopts.h"
|
#include "bbconfigopts.h"
|
||||||
|
|
||||||
int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int bbconfig_main(int argc, char **argv)
|
int bbconfig_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
printf(bbconfig_config);
|
printf(bbconfig_config);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -233,7 +233,8 @@ int chat_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
//-----------------------
|
//-----------------------
|
||||||
// do expect
|
// do expect
|
||||||
//-----------------------
|
//-----------------------
|
||||||
size_t expect_len, buf_len = 0;
|
int expect_len;
|
||||||
|
size_t buf_len = 0;
|
||||||
size_t max_len = max_abort_len;
|
size_t max_len = max_abort_len;
|
||||||
|
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
|
@ -3680,6 +3680,9 @@ static void check_tainted_module(struct obj_file *f, char *m_name)
|
|||||||
* start of some sections. this info is used by ksymoops to do better
|
* start of some sections. this info is used by ksymoops to do better
|
||||||
* debugging.
|
* debugging.
|
||||||
*/
|
*/
|
||||||
|
#if !ENABLE_FEATURE_INSMOD_VERSION_CHECKING
|
||||||
|
#define get_module_version(f, str) get_module_version(str)
|
||||||
|
#endif
|
||||||
static int
|
static int
|
||||||
get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
|
get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int lsmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int lsmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int lsmod_main(int argc, char **argv)
|
int lsmod_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
struct module_info info;
|
struct module_info info;
|
||||||
char *module_names, *mn, *deps, *dn;
|
char *module_names, *mn, *deps, *dn;
|
||||||
|
@ -17,7 +17,7 @@ lib-$(CONFIG_FTPPUT) += ftpgetput.o
|
|||||||
lib-$(CONFIG_HOSTNAME) += hostname.o
|
lib-$(CONFIG_HOSTNAME) += hostname.o
|
||||||
lib-$(CONFIG_HTTPD) += httpd.o
|
lib-$(CONFIG_HTTPD) += httpd.o
|
||||||
lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.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_IFUPDOWN) += ifupdown.o
|
||||||
lib-$(CONFIG_INETD) += inetd.o
|
lib-$(CONFIG_INETD) += inetd.o
|
||||||
lib-$(CONFIG_IP) += ip.o
|
lib-$(CONFIG_IP) += ip.o
|
||||||
|
@ -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) 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";
|
const char *ifname = "eth0";
|
||||||
char *pass;
|
char *pass;
|
||||||
|
@ -1972,7 +1972,11 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
|
|||||||
/* Try and do our best to parse more lines */
|
/* Try and do our best to parse more lines */
|
||||||
if ((STRNCASECMP(iobuf, "Content-length:") == 0)) {
|
if ((STRNCASECMP(iobuf, "Content-length:") == 0)) {
|
||||||
/* extra read only for POST */
|
/* 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;
|
tptr = iobuf + sizeof("Content-length:") - 1;
|
||||||
if (!tptr[0])
|
if (!tptr[0])
|
||||||
send_headers_and_exit(HTTP_BAD_REQUEST);
|
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,
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -483,9 +483,9 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
|
|||||||
};
|
};
|
||||||
#endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */
|
#endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
||||||
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
|
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
|
||||||
{
|
{
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
|
||||||
int i;
|
int i;
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_IP
|
#if ENABLE_FEATURE_IFUPDOWN_IP
|
||||||
/* ip doesn't up iface when it configures it (unlike ifconfig) */
|
/* 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");
|
bb_error_msg("no dhcp clients found");
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
#elif ENABLE_APP_UDHCPC
|
#elif ENABLE_APP_UDHCPC
|
||||||
|
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
|
||||||
|
{
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_IP
|
#if ENABLE_FEATURE_IFUPDOWN_IP
|
||||||
/* ip doesn't up iface when it configures it (unlike ifconfig) */
|
/* ip doesn't up iface when it configures it (unlike ifconfig) */
|
||||||
if (!execute("ip link set %iface% up", ifd, exec))
|
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 "
|
return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
|
||||||
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
|
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
|
||||||
ifd, exec);
|
ifd, exec);
|
||||||
#else
|
|
||||||
return 0; /* no dhcp support */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static int dhcp_up(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
|
||||||
|
execfn *exec ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return 0; /* no dhcp support */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
||||||
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
|
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
|
||||||
{
|
{
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
|
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
|
||||||
if (exists_execable(ext_dhcp_clients[i].name))
|
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");
|
bb_error_msg("no dhcp clients found, using static interface shutdown");
|
||||||
return static_down(ifd, exec);
|
return static_down(ifd, exec);
|
||||||
|
}
|
||||||
#elif ENABLE_APP_UDHCPC
|
#elif ENABLE_APP_UDHCPC
|
||||||
|
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
|
||||||
|
{
|
||||||
return execute("kill "
|
return execute("kill "
|
||||||
"`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
|
"`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
|
||||||
#else
|
|
||||||
return 0; /* no dhcp support */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static int dhcp_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
|
||||||
|
execfn *exec ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return 0; /* no dhcp support */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int manual_up_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED, execfn *exec ATTRIBUTE_UNUSED)
|
static int manual_up_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED, execfn *exec ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -1331,10 +1331,10 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
continue; /* -> check next fd in fd set */
|
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
|
#ifdef INETD_BUILTINS_ENABLED
|
||||||
if (sep->se_builtin) {
|
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 */
|
close(sep->se_fd); /* listening socket */
|
||||||
logmode = 0; /* make xwrite etc silent */
|
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);
|
sep->se_builtin->bi_stream_fn(ctrl, sep);
|
||||||
else
|
else
|
||||||
sep->se_builtin->bi_dgram_fn(ctrl, sep);
|
sep->se_builtin->bi_dgram_fn(ctrl, sep);
|
||||||
if (pid) /* we did fork */
|
if (pid) /* we did vfork */
|
||||||
_exit(0);
|
_exit(1);
|
||||||
maybe_close(accepted_fd);
|
maybe_close(accepted_fd);
|
||||||
continue; /* -> check next fd in fd set */
|
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);
|
xwrite(s, line, sz);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
/* We are after vfork here! */
|
||||||
static const char *const args[] = { "cat", NULL };
|
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);
|
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
|
||||||
BB_EXECVP("cat", (char**)args);
|
BB_EXECVP("cat", (char**)args);
|
||||||
_exit(1);
|
/* on failure we return to main, which does exit(1) */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
static void echo_dg(int s, servtab_t *sep)
|
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)
|
while (safe_read(s, line, LINE_SIZE) > 0)
|
||||||
continue;
|
continue;
|
||||||
#else
|
#else
|
||||||
|
/* We are after vfork here! */
|
||||||
static const char *const args[] = { "dd", "of=/dev/null", NULL };
|
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 */
|
/* no error messages */
|
||||||
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
|
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
|
||||||
BB_EXECVP("dd", (char**)args);
|
BB_EXECVP("dd", (char**)args);
|
||||||
_exit(1);
|
/* on failure we return to main, which does exit(1) */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* when compared to "standard" nc
|
* when compared to "standard" nc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void timeout(int signum)
|
static void timeout(int signum ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
bb_error_msg_and_die("timed out");
|
bb_error_msg_and_die("timed out");
|
||||||
}
|
}
|
||||||
|
@ -551,11 +551,11 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
// retrieve message in ./tmp/
|
// retrieve message in ./tmp/
|
||||||
pop3_check(retr, (const char *)nmsg);
|
pop3_check(retr, (const char *)(ptrdiff_t)nmsg);
|
||||||
pop3_message(filename);
|
pop3_message(filename);
|
||||||
// delete message from server
|
// delete message from server
|
||||||
if (opts & OPTF_z)
|
if (opts & OPTF_z)
|
||||||
pop3_check("DELE %u", (const char*)nmsg);
|
pop3_check("DELE %u", (const char*)(ptrdiff_t)nmsg);
|
||||||
|
|
||||||
// run postprocessing program
|
// run postprocessing program
|
||||||
if (*fargs) {
|
if (*fargs) {
|
||||||
|
@ -161,14 +161,14 @@ make_new_session(
|
|||||||
const char *login_argv[2];
|
const char *login_argv[2];
|
||||||
struct termios termbuf;
|
struct termios termbuf;
|
||||||
int fd, pid;
|
int fd, pid;
|
||||||
char tty_name[32];
|
char tty_name[GETPTY_BUFSIZE];
|
||||||
struct tsession *ts = xzalloc(sizeof(struct tsession) + BUFSIZE * 2);
|
struct tsession *ts = xzalloc(sizeof(struct tsession) + BUFSIZE * 2);
|
||||||
|
|
||||||
/*ts->buf1 = (char *)(ts + 1);*/
|
/*ts->buf1 = (char *)(ts + 1);*/
|
||||||
/*ts->buf2 = ts->buf1 + BUFSIZE;*/
|
/*ts->buf2 = ts->buf1 + BUFSIZE;*/
|
||||||
|
|
||||||
/* Got a new connection, set up a tty. */
|
/* Got a new connection, set up a tty. */
|
||||||
fd = getpty(tty_name, 32);
|
fd = getpty(tty_name);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
bb_error_msg("can't create pty");
|
bb_error_msg("can't create pty");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -729,6 +729,10 @@ pr_type(unsigned char t)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !ENABLE_FEATURE_TRACEROUTE_VERBOSE
|
||||||
|
#define packet_ok(buf, cc, from, seq) \
|
||||||
|
packet_ok(buf, cc, seq)
|
||||||
|
#endif
|
||||||
static int
|
static int
|
||||||
packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
|
packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ int raw_socket(int ifindex)
|
|||||||
BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0),
|
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 */
|
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, SERVER_AND_CLIENT_PORTS, 0, 1), /* L3, L4 */
|
||||||
/* returns */
|
/* 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 */
|
BPF_STMT(BPF_RET|BPF_K, 0), /* L4: reject */
|
||||||
};
|
};
|
||||||
static const struct sock_fprog filter_prog = {
|
static const struct sock_fprog filter_prog = {
|
||||||
|
@ -189,7 +189,7 @@ static void progressmeter(int flag)
|
|||||||
*/
|
*/
|
||||||
#else /* FEATURE_WGET_STATUSBAR */
|
#else /* FEATURE_WGET_STATUSBAR */
|
||||||
|
|
||||||
static ALWAYS_INLINE void progressmeter(int flag) { }
|
static ALWAYS_INLINE void progressmeter(int flag ATTRIBUTE_UNUSED) { }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ int ps_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int ps_main(int argc, char **argv)
|
int ps_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
procps_status_t *p = NULL;
|
procps_status_t *p = NULL;
|
||||||
int len;
|
int len;
|
||||||
|
20
shell/ash.c
20
shell/ash.c
@ -3247,6 +3247,9 @@ static pid_t backgndpid; /* pid of last background process */
|
|||||||
static smallint job_warning; /* user was warned about stopped jobs (can be 2, 1 or 0). */
|
static smallint job_warning; /* user was warned about stopped jobs (can be 2, 1 or 0). */
|
||||||
|
|
||||||
static struct job *makejob(/*union node *,*/ int);
|
static struct job *makejob(/*union node *,*/ int);
|
||||||
|
#if !JOBS
|
||||||
|
#define forkshell(job, node, mode) forkshell(job, mode)
|
||||||
|
#endif
|
||||||
static int forkshell(struct job *, union node *, int);
|
static int forkshell(struct job *, union node *, int);
|
||||||
static int waitforjob(struct job *);
|
static int waitforjob(struct job *);
|
||||||
|
|
||||||
@ -3424,6 +3427,9 @@ jobno(const struct job *jp)
|
|||||||
/*
|
/*
|
||||||
* Convert a job name to a job structure.
|
* Convert a job name to a job structure.
|
||||||
*/
|
*/
|
||||||
|
#if !JOBS
|
||||||
|
#define getjob(name, getctl) getjob(name)
|
||||||
|
#endif
|
||||||
static struct job *
|
static struct job *
|
||||||
getjob(const char *name, int getctl)
|
getjob(const char *name, int getctl)
|
||||||
{
|
{
|
||||||
@ -4533,6 +4539,9 @@ forkchild(struct job *jp, /*union node *n,*/ int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Called after fork(), in parent */
|
/* Called after fork(), in parent */
|
||||||
|
#if !JOBS
|
||||||
|
#define forkparent(jp, n, mode, pid) forkparent(jp, mode, pid)
|
||||||
|
#endif
|
||||||
static void
|
static void
|
||||||
forkparent(struct job *jp, union node *n, int mode, pid_t pid)
|
forkparent(struct job *jp, union node *n, int mode, pid_t pid)
|
||||||
{
|
{
|
||||||
@ -8674,8 +8683,8 @@ preadfd(void)
|
|||||||
char *buf = parsefile->buf;
|
char *buf = parsefile->buf;
|
||||||
parsenextc = buf;
|
parsenextc = buf;
|
||||||
|
|
||||||
retry:
|
|
||||||
#if ENABLE_FEATURE_EDITING
|
#if ENABLE_FEATURE_EDITING
|
||||||
|
retry:
|
||||||
if (!iflag || parsefile->fd)
|
if (!iflag || parsefile->fd)
|
||||||
nr = nonblock_safe_read(parsefile->fd, buf, BUFSIZ - 1);
|
nr = nonblock_safe_read(parsefile->fd, buf, BUFSIZ - 1);
|
||||||
else {
|
else {
|
||||||
@ -8876,8 +8885,11 @@ pungetc(void)
|
|||||||
* Push a string back onto the input at this current parsefile level.
|
* Push a string back onto the input at this current parsefile level.
|
||||||
* We handle aliases this way.
|
* We handle aliases this way.
|
||||||
*/
|
*/
|
||||||
|
#if !ENABLE_ASH_ALIAS
|
||||||
|
#define pushstring(s, ap) pushstring(s)
|
||||||
|
#endif
|
||||||
static void
|
static void
|
||||||
pushstring(char *s, void *ap)
|
pushstring(char *s, struct alias *ap)
|
||||||
{
|
{
|
||||||
struct strpush *sp;
|
struct strpush *sp;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -8894,9 +8906,9 @@ pushstring(char *s, void *ap)
|
|||||||
sp->prevstring = parsenextc;
|
sp->prevstring = parsenextc;
|
||||||
sp->prevnleft = parsenleft;
|
sp->prevnleft = parsenleft;
|
||||||
#if ENABLE_ASH_ALIAS
|
#if ENABLE_ASH_ALIAS
|
||||||
sp->ap = (struct alias *)ap;
|
sp->ap = ap;
|
||||||
if (ap) {
|
if (ap) {
|
||||||
((struct alias *)ap)->flag |= ALIASINUSE;
|
ap->flag |= ALIASINUSE;
|
||||||
sp->string = s;
|
sp->string = s;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,7 +38,7 @@ struct serial_struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int cttyhack_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int cttyhack_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int cttyhack_main(int argc, char **argv)
|
int cttyhack_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char console[sizeof(int)*3 + 16];
|
char console[sizeof(int)*3 + 16];
|
||||||
|
@ -170,10 +170,10 @@ enum {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_FBSET_READMODE
|
||||||
static int readmode(struct fb_var_screeninfo *base, const char *fn,
|
static int readmode(struct fb_var_screeninfo *base, const char *fn,
|
||||||
const char *mode)
|
const char *mode)
|
||||||
{
|
{
|
||||||
#if ENABLE_FEATURE_FBSET_READMODE
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
@ -257,11 +257,9 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bb_error_msg("mode reading not compiled in");
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void setmode(struct fb_var_screeninfo *base,
|
static inline void setmode(struct fb_var_screeninfo *base,
|
||||||
struct fb_var_screeninfo *set)
|
struct fb_var_screeninfo *set)
|
||||||
@ -389,9 +387,13 @@ int fbset_main(int argc, char **argv)
|
|||||||
fh = xopen(fbdev, O_RDONLY);
|
fh = xopen(fbdev, O_RDONLY);
|
||||||
xioctl(fh, FBIOGET_VSCREENINFO, &var);
|
xioctl(fh, FBIOGET_VSCREENINFO, &var);
|
||||||
if (g_options & OPT_READMODE) {
|
if (g_options & OPT_READMODE) {
|
||||||
|
#if !ENABLE_FEATURE_FBSET_READMODE
|
||||||
|
bb_show_usage();
|
||||||
|
#else
|
||||||
if (!readmode(&var, modefile, mode)) {
|
if (!readmode(&var, modefile, mode)) {
|
||||||
bb_error_msg_and_die("unknown video mode '%s'", mode);
|
bb_error_msg_and_die("unknown video mode '%s'", mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
setmode(&var, &varset);
|
setmode(&var, &varset);
|
||||||
|
@ -128,7 +128,11 @@ static unsigned read_int(unsigned low, unsigned dflt, unsigned high, unsigned ba
|
|||||||
#endif
|
#endif
|
||||||
static const char *partition_type(unsigned char type);
|
static const char *partition_type(unsigned char type);
|
||||||
static void get_geometry(void);
|
static void get_geometry(void);
|
||||||
|
#if ENABLE_FEATURE_SUN_LABEL || ENABLE_FEATURE_FDISK_WRITABLE
|
||||||
static int get_boot(enum action what);
|
static int get_boot(enum action what);
|
||||||
|
#else
|
||||||
|
static int get_boot(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PLURAL 0
|
#define PLURAL 0
|
||||||
#define SINGULAR 1
|
#define SINGULAR 1
|
||||||
@ -1237,8 +1241,12 @@ get_geometry(void)
|
|||||||
* 0: found or created label
|
* 0: found or created label
|
||||||
* 1: I/O error
|
* 1: I/O error
|
||||||
*/
|
*/
|
||||||
static int
|
#if ENABLE_FEATURE_SUN_LABEL || ENABLE_FEATURE_FDISK_WRITABLE
|
||||||
get_boot(enum action what)
|
static int get_boot(enum action what)
|
||||||
|
#else
|
||||||
|
static int get_boot(void)
|
||||||
|
#define get_boot(what) get_boot()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
int attr_ok; /* NB: 0: ok */
|
int attr_ok; /* NB: 0: ok */
|
||||||
int winsz_ok;
|
int winsz_ok;
|
||||||
int pty;
|
int pty;
|
||||||
char pty_line[32];
|
char pty_line[GETPTY_BUFSIZE];
|
||||||
struct termios tt, rtt;
|
struct termios tt, rtt;
|
||||||
struct winsize win;
|
struct winsize win;
|
||||||
const char *fname = "typescript";
|
const char *fname = "typescript";
|
||||||
@ -69,7 +69,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
shell = DEFAULT_SHELL;
|
shell = DEFAULT_SHELL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pty = getpty(pty_line, sizeof(pty_line));
|
pty = getpty(pty_line);
|
||||||
if (pty < 0) {
|
if (pty < 0) {
|
||||||
bb_perror_msg_and_die("can't get pty");
|
bb_perror_msg_and_die("can't get pty");
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,10 @@ static struct uuidCache_s {
|
|||||||
} *uuidCache;
|
} *uuidCache;
|
||||||
|
|
||||||
/* for now, only ext2, ext3 and xfs are supported */
|
/* for now, only ext2, ext3 and xfs are supported */
|
||||||
|
#if !ENABLE_FEATURE_VOLUMEID_ISO9660
|
||||||
|
#define get_label_uuid(device, label, uuid, iso_only) \
|
||||||
|
get_label_uuid(device, label, uuid)
|
||||||
|
#endif
|
||||||
static int
|
static int
|
||||||
get_label_uuid(const char *device, char **label, char **uuid, int iso_only)
|
get_label_uuid(const char *device, char **label, char **uuid, int iso_only)
|
||||||
{
|
{
|
||||||
@ -83,6 +87,10 @@ uuidcache_addentry(char * device, int major, int minor, char *label, char *uuid)
|
|||||||
memcpy(last->uuid, uuid, sizeof(last->uuid));
|
memcpy(last->uuid, uuid, sizeof(last->uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !ENABLE_FEATURE_VOLUMEID_ISO9660
|
||||||
|
#define uuidcache_check_device(device_name, ma, mi, iso_only) \
|
||||||
|
uuidcache_check_device(device_name, ma, mi)
|
||||||
|
#endif
|
||||||
static void
|
static void
|
||||||
uuidcache_check_device(const char *device_name, int ma, int mi, int iso_only)
|
uuidcache_check_device(const char *device_name, int ma, int mi, int iso_only)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user