aboutsummaryrefslogtreecommitdiffstats
path: root/package/busybox/patches
diff options
context:
space:
mode:
authorNicolas Thill <nico@openwrt.org>2009-05-25 17:15:39 +0000
committerNicolas Thill <nico@openwrt.org>2009-05-25 17:15:39 +0000
commit730226709b5aff5800c938b5bae7c9fd86cffeb0 (patch)
tree0f3d3144dd3e93a0865e6f391a65a5cb6fad136a /package/busybox/patches
parent45f61a72684e63899f81c51171b650933e2ea2e7 (diff)
downloadmaster-187ad058-730226709b5aff5800c938b5bae7c9fd86cffeb0.tar.gz
master-187ad058-730226709b5aff5800c938b5bae7c9fd86cffeb0.tar.bz2
master-187ad058-730226709b5aff5800c938b5bae7c9fd86cffeb0.zip
[package] busybox: update to v1.13.4 (closes: #4279)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16063 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/busybox/patches')
-rw-r--r--package/busybox/patches/001-init_avoid_loop_opening_tty.patch2
-rw-r--r--package/busybox/patches/002-darwin_compile_fix.patch13
-rw-r--r--package/busybox/patches/110-wget_getopt_fix.patch8
-rw-r--r--package/busybox/patches/240-udhcpc_retries.patch2
-rw-r--r--package/busybox/patches/241-udhcpc-oversized_packets.patch12
-rw-r--r--package/busybox/patches/242-udhcpc_msgs.patch10
-rw-r--r--package/busybox/patches/243-udhcpc_changed_ifindex.patch4
-rw-r--r--package/busybox/patches/250-ash_export-n.patch4
-rw-r--r--package/busybox/patches/300-netmsg.patch6
-rw-r--r--package/busybox/patches/310-passwd_access.patch2
-rw-r--r--package/busybox/patches/340-lock_util.patch8
-rw-r--r--package/busybox/patches/350-httpd_redir.patch16
-rw-r--r--package/busybox/patches/410-httpd_cgi_headers.patch2
-rw-r--r--package/busybox/patches/440-httpd_chdir.patch2
-rw-r--r--package/busybox/patches/450-httpd_accept_header.patch42
-rw-r--r--package/busybox/patches/470-insmod_search.patch653
-rw-r--r--package/busybox/patches/480-vi_search.patch22
-rw-r--r--package/busybox/patches/510-awk_include.patch12
-rw-r--r--package/busybox/patches/530-unsigned_bitwise_ops.patch0
-rw-r--r--package/busybox/patches/803-id_getgrouplist.patch49
-rw-r--r--package/busybox/patches/810-lsmod-infinite-loop.patch11
21 files changed, 113 insertions, 767 deletions
diff --git a/package/busybox/patches/001-init_avoid_loop_opening_tty.patch b/package/busybox/patches/001-init_avoid_loop_opening_tty.patch
index 25f690ab58..ed790d807b 100644
--- a/package/busybox/patches/001-init_avoid_loop_opening_tty.patch
+++ b/package/busybox/patches/001-init_avoid_loop_opening_tty.patch
@@ -1,6 +1,6 @@
--- a/init/init.c
+++ b/init/init.c
-@@ -498,12 +498,11 @@ static void run_actions(int action_type)
+@@ -497,12 +497,11 @@ static void run_actions(int action_type)
for (a = init_action_list; a; a = tmp) {
tmp = a->next;
if (a->action_type & action_type) {
diff --git a/package/busybox/patches/002-darwin_compile_fix.patch b/package/busybox/patches/002-darwin_compile_fix.patch
deleted file mode 100644
index a5c5379f97..0000000000
--- a/package/busybox/patches/002-darwin_compile_fix.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -83,7 +83,10 @@
- extern char **environ;
-
- /* Set the group set for the current user to GROUPS (N of them). */
-+#if !defined(__APPLE__)
- int setgroups(size_t n, const gid_t *groups);
-+#endif
-+
- #if defined(__GLIBC__) && __GLIBC__ < 2
- int vdprintf(int d, const char *format, va_list ap);
- #endif
diff --git a/package/busybox/patches/110-wget_getopt_fix.patch b/package/busybox/patches/110-wget_getopt_fix.patch
index 8837769345..187603d059 100644
--- a/package/busybox/patches/110-wget_getopt_fix.patch
+++ b/package/busybox/patches/110-wget_getopt_fix.patch
@@ -1,9 +1,9 @@
--- a/networking/wget.c
+++ b/networking/wget.c
-@@ -437,7 +437,7 @@ int wget_main(int argc UNUSED_PARAM, cha
- "directory-prefix\0" Required_argument "P"
- "proxy\0" Required_argument "Y"
- "user-agent\0" Required_argument "U"
+@@ -443,7 +443,7 @@ int wget_main(int argc UNUSED_PARAM, cha
+ // "tries\0" Required_argument "t"
+ // "timeout\0" Required_argument "T"
+ /* Ignored (we always use PASV): */
- "passive-ftp\0" No_argument "\xff"
+ "passive-ftp\0" No_argument "\xfd"
"header\0" Required_argument "\xfe"
diff --git a/package/busybox/patches/240-udhcpc_retries.patch b/package/busybox/patches/240-udhcpc_retries.patch
index f45fc6eebd..be452c076a 100644
--- a/package/busybox/patches/240-udhcpc_retries.patch
+++ b/package/busybox/patches/240-udhcpc_retries.patch
@@ -9,7 +9,7 @@
if (packet_num == 0)
xid = random_xid();
-@@ -383,7 +383,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
+@@ -384,7 +384,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
continue;
case RENEW_REQUESTED:
case REQUESTING:
diff --git a/package/busybox/patches/241-udhcpc-oversized_packets.patch b/package/busybox/patches/241-udhcpc-oversized_packets.patch
index 7eda8c1e35..6019297b24 100644
--- a/package/busybox/patches/241-udhcpc-oversized_packets.patch
+++ b/package/busybox/patches/241-udhcpc-oversized_packets.patch
@@ -1,6 +1,6 @@
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
-@@ -114,6 +114,10 @@ uint16_t udhcp_checksum(void *addr, int
+@@ -114,6 +114,10 @@ uint16_t FAST_FUNC udhcp_checksum(void *
return ~sum;
}
@@ -10,8 +10,8 @@
+}
/* Construct a ip/udp header for a packet, send packet */
- int udhcp_send_raw_packet(struct dhcpMessage *payload,
-@@ -125,11 +129,7 @@ int udhcp_send_raw_packet(struct dhcpMes
+ int FAST_FUNC udhcp_send_raw_packet(struct dhcpMessage *payload,
+@@ -126,11 +130,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru
int fd;
int result = -1;
const char *msg;
@@ -24,7 +24,7 @@
fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
if (fd < 0) {
-@@ -139,7 +139,7 @@ int udhcp_send_raw_packet(struct dhcpMes
+@@ -140,7 +140,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru
memset(&dest, 0, sizeof(dest));
memset(&packet, 0, sizeof(packet));
@@ -33,7 +33,7 @@
dest.sll_family = AF_PACKET;
dest.sll_protocol = htons(ETH_P_IP);
-@@ -156,23 +156,18 @@ int udhcp_send_raw_packet(struct dhcpMes
+@@ -157,23 +157,18 @@ int FAST_FUNC udhcp_send_raw_packet(stru
packet.ip.daddr = dest_ip;
packet.udp.source = htons(source_port);
packet.udp.dest = htons(dest_port);
@@ -63,7 +63,7 @@
(struct sockaddr *) &dest, sizeof(dest));
msg = "sendto";
ret_close:
-@@ -224,8 +219,7 @@ int udhcp_send_kernel_packet(struct dhcp
+@@ -225,8 +220,7 @@ int FAST_FUNC udhcp_send_kernel_packet(s
goto ret_close;
}
diff --git a/package/busybox/patches/242-udhcpc_msgs.patch b/package/busybox/patches/242-udhcpc_msgs.patch
index db4fa314bb..0140c7854f 100644
--- a/package/busybox/patches/242-udhcpc_msgs.patch
+++ b/package/busybox/patches/242-udhcpc_msgs.patch
@@ -1,18 +1,18 @@
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
-@@ -101,6 +101,7 @@ int send_decline(uint32_t xid, uint32_t
- int send_discover(uint32_t xid, uint32_t requested)
+@@ -126,6 +126,7 @@ int FAST_FUNC send_decline(uint32_t xid,
+ int FAST_FUNC send_discover(uint32_t xid, uint32_t requested)
{
struct dhcpMessage packet;
+ static int msgs = 0;
init_packet(&packet, DHCPDISCOVER);
packet.xid = xid;
-@@ -113,6 +114,7 @@ int send_discover(uint32_t xid, uint32_t
+@@ -138,6 +139,7 @@ int FAST_FUNC send_discover(uint32_t xid
add_param_req_option(&packet);
+ if (msgs++ < 3)
bb_info_msg("Sending discover...");
- return udhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
- SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
+ return raw_bcast_from_client_config_ifindex(&packet);
+ }
diff --git a/package/busybox/patches/243-udhcpc_changed_ifindex.patch b/package/busybox/patches/243-udhcpc_changed_ifindex.patch
index 96936e4e3d..29727556d1 100644
--- a/package/busybox/patches/243-udhcpc_changed_ifindex.patch
+++ b/package/busybox/patches/243-udhcpc_changed_ifindex.patch
@@ -8,8 +8,8 @@
+ * member interfaces were added/removed or if the status of the
+ * bridge changed).
+ * Workaround: refresh it here before processing the next packet */
-+ read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.arp);
++ udhcp_read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.arp);
+
if (listen_mode != LISTEN_NONE && sockfd < 0) {
if (listen_mode == LISTEN_KERNEL)
- sockfd = listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface);
+ sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface);
diff --git a/package/busybox/patches/250-ash_export-n.patch b/package/busybox/patches/250-ash_export-n.patch
index 50eaa62d0b..71697b116e 100644
--- a/package/busybox/patches/250-ash_export-n.patch
+++ b/package/busybox/patches/250-ash_export-n.patch
@@ -1,6 +1,6 @@
--- a/shell/ash.c
+++ b/shell/ash.c
-@@ -12018,8 +12018,17 @@ exportcmd(int argc UNUSED_PARAM, char **
+@@ -12159,8 +12159,17 @@ exportcmd(int argc UNUSED_PARAM, char **
const char *p;
char **aptr;
int flag = argv[0][0] == 'r' ? VREADONLY : VEXPORT;
@@ -19,7 +19,7 @@
aptr = argptr;
name = *aptr;
if (name) {
-@@ -12031,10 +12040,12 @@ exportcmd(int argc UNUSED_PARAM, char **
+@@ -12172,10 +12181,12 @@ exportcmd(int argc UNUSED_PARAM, char **
vp = *findvar(hashvar(name), name);
if (vp) {
vp->flags |= flag;
diff --git a/package/busybox/patches/300-netmsg.patch b/package/busybox/patches/300-netmsg.patch
index ae5be7eead..575f5873c1 100644
--- a/package/busybox/patches/300-netmsg.patch
+++ b/package/busybox/patches/300-netmsg.patch
@@ -1,6 +1,6 @@
--- a/include/applets.h
+++ b/include/applets.h
-@@ -261,6 +261,7 @@ USE_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_
+@@ -263,6 +263,7 @@ USE_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_
USE_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
@@ -10,7 +10,7 @@
USE_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
--- a/include/usage.h
+++ b/include/usage.h
-@@ -2816,6 +2816,9 @@
+@@ -2849,6 +2849,9 @@
#endif
@@ -37,7 +37,7 @@
default n
--- a/networking/Kbuild
+++ b/networking/Kbuild
-@@ -24,6 +24,7 @@ lib-$(CONFIG_IP) += ip.o
+@@ -23,6 +23,7 @@ lib-$(CONFIG_IP) += ip.o
lib-$(CONFIG_IPCALC) += ipcalc.o
lib-$(CONFIG_NAMEIF) += nameif.o
lib-$(CONFIG_NC) += nc.o
diff --git a/package/busybox/patches/310-passwd_access.patch b/package/busybox/patches/310-passwd_access.patch
index 1c246fcf23..f90c840baf 100644
--- a/package/busybox/patches/310-passwd_access.patch
+++ b/package/busybox/patches/310-passwd_access.patch
@@ -3,7 +3,7 @@
--- a/networking/httpd.c
+++ b/networking/httpd.c
-@@ -1705,21 +1705,32 @@ static int check_user_passwd(const char
+@@ -1713,21 +1713,32 @@ static int check_user_passwd(const char
if (ENABLE_FEATURE_HTTPD_AUTH_MD5) {
char *md5_passwd;
diff --git a/package/busybox/patches/340-lock_util.patch b/package/busybox/patches/340-lock_util.patch
index 6276de9298..d5f8ac849b 100644
--- a/package/busybox/patches/340-lock_util.patch
+++ b/package/busybox/patches/340-lock_util.patch
@@ -1,6 +1,6 @@
--- a/include/applets.h
+++ b/include/applets.h
-@@ -222,6 +222,7 @@ USE_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN
+@@ -223,6 +223,7 @@ USE_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN
USE_LOAD_POLICY(APPLET(load_policy, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_LOADFONT(APPLET(loadfont, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER))
@@ -10,7 +10,7 @@
USE_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, logname))
--- a/include/usage.h
+++ b/include/usage.h
-@@ -2132,6 +2132,9 @@
+@@ -2150,6 +2150,9 @@
#define loadkmap_example_usage \
"$ loadkmap < /etc/i18n/lang-keymap\n"
@@ -22,7 +22,7 @@
#define logger_full_usage "\n\n" \
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
-@@ -366,6 +366,12 @@ config FEATURE_HDPARM_HDIO_GETSET_DMA
+@@ -395,6 +395,12 @@ config FEATURE_HDPARM_HDIO_GETSET_DMA
Enables the 'hdparm -d' option to get/set using_dma flag.
This is dangerous stuff, so you should probably say N.
@@ -37,7 +37,7 @@
default n
--- a/miscutils/Kbuild
+++ b/miscutils/Kbuild
-@@ -20,6 +20,7 @@ lib-$(CONFIG_INOTIFYD) += inotifyd.o
+@@ -21,6 +21,7 @@ lib-$(CONFIG_INOTIFYD) += inotifyd.o
lib-$(CONFIG_FEATURE_LAST_SMALL)+= last.o
lib-$(CONFIG_FEATURE_LAST_FANCY)+= last_fancy.o
lib-$(CONFIG_LESS) += less.o
diff --git a/package/busybox/patches/350-httpd_redir.patch b/package/busybox/patches/350-httpd_redir.patch
index ab25cd203d..da2fab695d 100644
--- a/package/busybox/patches/350-httpd_redir.patch
+++ b/package/busybox/patches/350-httpd_redir.patch
@@ -1,6 +1,6 @@
--- a/include/usage.h
+++ b/include/usage.h
-@@ -1552,7 +1552,8 @@
+@@ -1558,7 +1558,8 @@
USE_FEATURE_HTTPD_BASIC_AUTH(" [-r realm]") \
USE_FEATURE_HTTPD_AUTH_MD5(" [-m pass]") \
" [-h home]" \
@@ -10,7 +10,7 @@
#define httpd_full_usage "\n\n" \
"Listen for incoming HTTP requests\n" \
"\nOptions:" \
-@@ -1570,6 +1571,8 @@
+@@ -1576,6 +1577,8 @@
"\n -h HOME Home directory (default .)" \
"\n -e STRING HTML encode STRING" \
"\n -d STRING URL decode STRING" \
@@ -18,7 +18,7 @@
+ "\n -H HOST Redirect target host" \
#define hwclock_trivial_usage \
- USE_GETOPT_LONG( \
+ USE_FEATURE_HWCLOCK_LONG_OPTIONS( \
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -248,6 +248,8 @@ struct globals {
@@ -30,7 +30,7 @@
Htaccess_IP *ip_a_d; /* config allow/deny lines */
USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
-@@ -293,6 +295,8 @@ struct globals {
+@@ -295,6 +297,8 @@ struct globals {
#define index_page (G.index_page )
#define found_mime_type (G.found_mime_type )
#define found_moved_temporarily (G.found_moved_temporarily)
@@ -39,7 +39,7 @@
#define last_mod (G.last_mod )
#define ip_a_d (G.ip_a_d )
#define g_realm (G.g_realm )
-@@ -999,8 +1003,11 @@ static void send_headers(int responseNum
+@@ -1003,8 +1007,11 @@ static void send_headers(int responseNum
}
#endif
if (responseNum == HTTP_MOVED_TEMPORARILY) {
@@ -52,7 +52,7 @@
(g_query ? "?" : ""),
(g_query ? g_query : ""));
}
-@@ -1931,8 +1938,12 @@ static void handle_incoming_and_exit(con
+@@ -1939,8 +1946,12 @@ static void handle_incoming_and_exit(con
} while (*++tptr);
*++urlp = '\0'; /* terminate after last character */
@@ -66,7 +66,7 @@
if (is_directory(urlcopy + 1, 1, &sb)) {
found_moved_temporarily = urlcopy;
}
-@@ -2281,7 +2292,9 @@ static void sighup_handler(int sig)
+@@ -2293,7 +2304,9 @@ static void sighup_handler(int sig)
#endif
enum {
@@ -77,7 +77,7 @@
d_opt_decode_url,
h_opt_home_httpd,
USE_FEATURE_HTTPD_ENCODE_URL_STR(e_opt_encode_url,)
-@@ -2330,12 +2343,13 @@ int httpd_main(int argc UNUSED_PARAM, ch
+@@ -2342,12 +2355,13 @@ int httpd_main(int argc UNUSED_PARAM, ch
/* We do not "absolutize" path given by -h (home) opt.
* If user gives relative path in -h,
* $SCRIPT_FILENAME will not be set. */
diff --git a/package/busybox/patches/410-httpd_cgi_headers.patch b/package/busybox/patches/410-httpd_cgi_headers.patch
index b47751a809..4339462a80 100644
--- a/package/busybox/patches/410-httpd_cgi_headers.patch
+++ b/package/busybox/patches/410-httpd_cgi_headers.patch
@@ -1,6 +1,6 @@
--- a/networking/httpd.c
+++ b/networking/httpd.c
-@@ -1255,10 +1255,10 @@ static NOINLINE void cgi_io_loop_and_exi
+@@ -1259,10 +1259,10 @@ static NOINLINE void cgi_io_loop_and_exi
if (full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1)
break;
}
diff --git a/package/busybox/patches/440-httpd_chdir.patch b/package/busybox/patches/440-httpd_chdir.patch
index 744e962d9e..0d5769651b 100644
--- a/package/busybox/patches/440-httpd_chdir.patch
+++ b/package/busybox/patches/440-httpd_chdir.patch
@@ -1,6 +1,6 @@
--- a/networking/httpd.c
+++ b/networking/httpd.c
-@@ -1816,6 +1816,7 @@ static void handle_incoming_and_exit(con
+@@ -1824,6 +1824,7 @@ static void handle_incoming_and_exit(con
char *header_ptr = header_ptr;
Htaccess_Proxy *proxy_entry;
#endif
diff --git a/package/busybox/patches/450-httpd_accept_header.patch b/package/busybox/patches/450-httpd_accept_header.patch
deleted file mode 100644
index 88dfcfbb06..0000000000
--- a/package/busybox/patches/450-httpd_accept_header.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/networking/httpd.c
-+++ b/networking/httpd.c
-@@ -256,6 +256,8 @@ struct globals {
- USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
- USE_FEATURE_HTTPD_CGI(char *referer;)
- USE_FEATURE_HTTPD_CGI(char *user_agent;)
-+ USE_FEATURE_HTTPD_CGI(char *http_accept;)
-+ USE_FEATURE_HTTPD_CGI(char *http_accept_language;)
-
- off_t file_size; /* -1 - unknown */
- #if ENABLE_FEATURE_HTTPD_RANGES
-@@ -303,6 +305,8 @@ struct globals {
- #define remoteuser (G.remoteuser )
- #define referer (G.referer )
- #define user_agent (G.user_agent )
-+#define http_accept (G.http_accept )
-+#define http_accept_language (G.http_accept_language)
- #define file_size (G.file_size )
- #if ENABLE_FEATURE_HTTPD_RANGES
- #define range_start (G.range_start )
-@@ -1391,6 +1395,10 @@ static void send_cgi_and_exit(
- }
- }
- setenv1("HTTP_USER_AGENT", user_agent);
-+ if (http_accept)
-+ setenv1("HTTP_ACCEPT", http_accept);
-+ if (http_accept_language)
-+ setenv1("HTTP_ACCEPT_LANGUAGE", http_accept_language);
- if (post_len)
- putenv(xasprintf("CONTENT_LENGTH=%d", post_len));
- if (cookie)
-@@ -2028,6 +2036,10 @@ static void handle_incoming_and_exit(con
- referer = xstrdup(skip_whitespace(iobuf + sizeof("Referer:")-1));
- } else if (STRNCASECMP(iobuf, "User-Agent:") == 0) {
- user_agent = xstrdup(skip_whitespace(iobuf + sizeof("User-Agent:")-1));
-+ } else if (STRNCASECMP(iobuf, "Accept:") == 0) {
-+ http_accept = xstrdup(skip_whitespace(iobuf + sizeof("Accept:")-1));
-+ } else if (STRNCASECMP(iobuf, "Accept-Language:") == 0) {
-+ http_accept_language = xstrdup(skip_whitespace(iobuf + sizeof("Accept-Language:")-1));
- }
- #endif
- #if ENABLE_FEATURE_HTTPD_BASIC_AUTH
diff --git a/package/busybox/patches/470-insmod_search.patch b/package/busybox/patches/470-insmod_search.patch
index 62619c2213..8d4b019c6b 100644
--- a/package/busybox/patches/470-insmod_search.patch
+++ b/package/busybox/patches/470-insmod_search.patch
@@ -1,35 +1,17 @@
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
-@@ -61,21 +61,117 @@
+@@ -9,6 +9,99 @@
+
#include "libbb.h"
- #include <libgen.h>
- #include <sys/utsname.h>
-+#if ENABLE_FEATURE_2_6_MODULES
+ #include "modutils.h"
++#ifndef CONFIG_FEATURE_2_4_MODULES
+#include <sys/mman.h>
+#include <asm/unistd.h>
+#include <sys/syscall.h>
++#include <sys/utsname.h>
+#endif
-
- #if !ENABLE_FEATURE_2_4_MODULES && !ENABLE_FEATURE_2_6_MODULES
- #undef ENABLE_FEATURE_2_4_MODULES
- #define ENABLE_FEATURE_2_4_MODULES 1
- #endif
-
--/*
-- * Big piece of 2.4-specific code
-- */
- #if ENABLE_FEATURE_2_4_MODULES
--
-+int insmod_main_24(int argc, char **argv);
-+#endif
- #if ENABLE_FEATURE_2_6_MODULES
--static int insmod_ng_main(int argc, char **argv);
-+int insmod_main_26(int argc, char **argv);
- #endif
-+int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+
+static char *g_filename = NULL;
-+#define _PATH_MODULES "/lib/modules"
+
+static int FAST_FUNC check_module_name_match(const char *filename, struct stat *statbuf,
+ void *userdata, int depth)
@@ -92,7 +74,7 @@
+ * follow symlinks, but we do want to follow the
+ * /lib/modules/`uname -r` dir, So resolve it ourselves
+ * if it is a link... */
-+ module_dir = concat_path_file(_PATH_MODULES, myuname.release);
++ module_dir = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, myuname.release);
+ if (realpath(module_dir, real_module_dir) != NULL) {
+ free(module_dir);
+ module_dir = real_module_dir;
@@ -112,623 +94,26 @@
+
+done:
+ free(filename);
-
-+ return ret;
-+}
-+
-+/*
-+ * Big piece of 2.4-specific code
-+ */
-+#if ENABLE_FEATURE_2_4_MODULES
- #if ENABLE_FEATURE_INSMOD_LOADINKMEM
- #define LOADBITS 0
- #else
-@@ -184,7 +280,6 @@ static int insmod_ng_main(int argc, char
- /* Microblaze */
- #if defined(__microblaze__)
- #define USE_SINGLE
--#include <linux/elf-em.h>
- #define MATCH_MACHINE(x) (x == EM_XILINX_MICROBLAZE)
- #define SHT_RELM SHT_RELA
- #define Elf32_RelM Elf32_Rela
-@@ -452,7 +547,7 @@ enum {
- /* The system calls unchanged between 2.0 and 2.1. */
-
- unsigned long create_module(const char *, size_t);
--int delete_module(const char *module, unsigned int flags);
-+int delete_module(const char *);
-
-
- #endif /* module.h */
-@@ -652,7 +747,7 @@ static struct obj_symbol *arch_new_symbo
-
- static enum obj_reloc arch_apply_relocation(struct obj_file *f,
- struct obj_section *targsec,
-- /*struct obj_section *symsec,*/
-+ struct obj_section *symsec,
- struct obj_symbol *sym,
- ElfW(RelM) *rel, ElfW(Addr) value);
-
-@@ -673,6 +768,7 @@ static int obj_gpl_license(struct obj_fi
- #define SPFX ""
- #endif
-
+
- enum { STRVERSIONLEN = 64 };
-
- /*======================================================================*/
-@@ -788,28 +884,6 @@ static char *m_filename;
- static char *m_fullName;
-
-
--/*======================================================================*/
--
--
--static int FAST_FUNC check_module_name_match(const char *filename,
-- struct stat *statbuf UNUSED_PARAM,
-- void *userdata, int depth UNUSED_PARAM)
--{
-- char *fullname = (char *) userdata;
-- char *tmp;
--
-- if (fullname[0] == '\0')
-- return FALSE;
--
-- tmp = bb_get_last_path_component_nostrip(filename);
-- if (strcmp(tmp, fullname) == 0) {
-- /* Stop searching if we find a match */
-- m_filename = xstrdup(filename);
-- return FALSE;
-- }
-- return TRUE;
--}
--
-
- /*======================================================================*/
-
-@@ -835,32 +909,20 @@ static struct obj_symbol *arch_new_symbo
- static enum obj_reloc
- arch_apply_relocation(struct obj_file *f,
- struct obj_section *targsec,
-- /*struct obj_section *symsec,*/
-+ struct obj_section *symsec,
- struct obj_symbol *sym,
- ElfW(RelM) *rel, ElfW(Addr) v)
- {
--#if defined(__arm__) || defined(__i386__) || defined(__mc68000__) \
-- || defined(__sh__) || defined(__s390__) || defined(__x86_64__) \
-- || defined(__powerpc__) || defined(__mips__)
- struct arch_file *ifile = (struct arch_file *) f;
--#endif
- enum obj_reloc ret = obj_reloc_ok;
- ElfW(Addr) *loc = (ElfW(Addr) *) (targsec->contents + rel->r_offset);
--#if defined(__arm__) || defined(__H8300H__) || defined(__H8300S__) \
-- || defined(__i386__) || defined(__mc68000__) || defined(__microblaze__) \
-- || defined(__mips__) || defined(__nios2__) || defined(__powerpc__) \
-- || defined(__s390__) || defined(__sh__) || defined(__x86_64__)
- ElfW(Addr) dot = targsec->header.sh_addr + rel->r_offset;
--#endif
- #if defined(USE_GOT_ENTRIES) || defined(USE_PLT_ENTRIES)
- struct arch_symbol *isym = (struct arch_symbol *) sym;
- #endif
--#if defined(__arm__) || defined(__i386__) || defined(__mc68000__) \
-- || defined(__sh__) || defined(__s390__)
- #if defined(USE_GOT_ENTRIES)
- ElfW(Addr) got = ifile->got ? ifile->got->header.sh_addr : 0;
- #endif
--#endif
- #if defined(USE_PLT_ENTRIES)
- ElfW(Addr) plt = ifile->plt ? ifile->plt->header.sh_addr : 0;
- unsigned long *ip;
-@@ -954,7 +1016,6 @@ arch_apply_relocation(struct obj_file *f
-
- case R_386_PLT32:
- case R_386_PC32:
-- case R_386_GOTOFF:
- *loc += v - dot;
- break;
-
-@@ -973,6 +1034,9 @@ arch_apply_relocation(struct obj_file *f
-
- case R_386_GOT32:
- goto bb_use_got;
-+
-+ case R_386_GOTOFF:
-+ *loc += v - got;
- break;
-
- #elif defined(__microblaze__)
-@@ -1764,7 +1828,7 @@ static int arch_list_add(ElfW(RelM) *rel
-
- #if defined(USE_SINGLE)
-
--static int arch_single_init(/*ElfW(RelM) *rel,*/ struct arch_single_entry *single,
-+static int arch_single_init(ElfW(RelM) *rel, struct arch_single_entry *single,
- int offset, int size)
- {
- if (single->allocated == 0) {
-@@ -1912,7 +1976,7 @@ static void arch_create_got(struct obj_f
- #if defined(USE_GOT_ENTRIES)
- if (got_allocate) {
- got_offset += arch_single_init(
-- /*rel,*/ &intsym->gotent,
-+ rel, &intsym->gotent,
- got_offset, GOT_ENTRY_SIZE);
-
- got_needed = 1;
-@@ -1926,7 +1990,7 @@ static void arch_create_got(struct obj_f
- plt_offset, PLT_ENTRY_SIZE);
- #else
- plt_offset += arch_single_init(
-- /*rel,*/ &intsym->pltent,
-+ rel, &intsym->pltent,
- plt_offset, PLT_ENTRY_SIZE);
- #endif
- plt_needed = 1;
-@@ -1964,8 +2028,7 @@ static unsigned long obj_elf_hash_n(cons
- while (n > 0) {
- ch = *name++;
- h = (h << 4) + ch;
-- g = (h & 0xf0000000);
-- if (g != 0) {
-+ if ((g = (h & 0xf0000000)) != 0) {
- h ^= g >> 24;
- h &= ~g;
- }
-@@ -2044,7 +2107,7 @@ obj_add_symbol(struct obj_file *f, const
- int n_type = ELF_ST_TYPE(info);
- int n_binding = ELF_ST_BIND(info);
-
-- for (sym = f->symtab[hash]; sym; sym = sym->next) {
-+ for (sym = f->symtab[hash]; sym; sym = sym->next)
- if (f->symbol_cmp(sym->name, name) == 0) {
- int o_secidx = sym->secidx;
- int o_info = sym->info;
-@@ -2103,14 +2166,14 @@ obj_add_symbol(struct obj_file *f, const
- return sym;
- }
- }
-- }
-
- /* Completely new symbol. */
- sym = arch_new_symbol();
- sym->next = f->symtab[hash];
- f->symtab[hash] = sym;
- sym->ksymidx = -1;
-- if (ELF_ST_BIND(info) == STB_LOCAL && symidx != (unsigned long)(-1)) {
-+
-+ if (ELF_ST_BIND(info) == STB_LOCAL && symidx != -1) {
- if (symidx >= f->local_symtab_size)
- bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld",
- name, (long) symidx, (long) f->local_symtab_size);
-@@ -3234,7 +3297,7 @@ static int obj_relocate(struct obj_file
-
- /* Do it! */
- switch (arch_apply_relocation
-- (f, targsec, /*symsec,*/ intsym, rel, value)
-+ (f, targsec, symsec, intsym, rel, value)
- ) {
- case obj_reloc_ok:
- break;
-@@ -3313,11 +3376,11 @@ static int obj_create_image(struct obj_f
-
- /*======================================================================*/
-
--static struct obj_file *obj_load(FILE *fp, int loadprogbits UNUSED_PARAM)
-+static struct obj_file *obj_load(FILE *fp, int loadprogbits)
- {
- struct obj_file *f;
- ElfW(Shdr) * section_headers;
-- size_t shnum, i;
-+ int shnum, i;
- char *shstrtab;
-
- /* Read the file header. */
-@@ -3591,7 +3654,7 @@ static int obj_gpl_license(struct obj_fi
- while (ptr < endptr) {
- value = strchr(ptr, '=');
- if (value && strncmp(ptr, "license", value-ptr) == 0) {
-- unsigned i;
-+ int i;
- if (license)
- *license = value+1;
- for (i = 0; i < ARRAY_SIZE(gpl_licenses); ++i) {
-@@ -3695,9 +3758,6 @@ static void check_tainted_module(struct
- * start of some sections. this info is used by ksymoops to do better
- * debugging.
- */
--#if !ENABLE_FEATURE_INSMOD_VERSION_CHECKING
--#define get_module_version(f, str) get_module_version(str)
--#endif
- static int
- get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
- {
-@@ -3730,8 +3790,7 @@ add_ksymoops_symbols(struct obj_file *f,
- struct obj_symbol *sym;
- char *name, *absolute_filename;
- char str[STRVERSIONLEN];
-- unsigned i;
-- int l, lm_name, lfilename, use_ksymtab, version;
-+ int i, l, lm_name, lfilename, use_ksymtab, version;
- struct stat statbuf;
-
- /* WARNING: was using realpath, but replaced by readlink to stop using
-@@ -3922,145 +3981,57 @@ static void print_load_map(struct obj_fi
- void print_load_map(struct obj_file *f);
- #endif
-
--int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
--int insmod_main(int argc, char **argv)
-+int insmod_main_24( int argc, char **argv)
- {
- char *opt_o, *arg1;
-- int len;
- int k_crcs;
-- char *tmp, *tmp1;
- unsigned long m_size;
- ElfW(Addr) m_addr;
- struct obj_file *f;
-- struct stat st;
-- char *m_name = NULL;
-- int exit_status = EXIT_FAILURE;
-+ char *tmp = NULL, *m_name = NULL;
-+ int ret = EINVAL;
- int m_has_modinfo;
- #if ENABLE_FEATURE_INSMOD_VERSION_CHECKING
- struct utsname uts_info;
- char m_strversion[STRVERSIONLEN];
- int m_version, m_crcs;
- #endif
--#if ENABLE_FEATURE_CLEAN_UP
- FILE *fp = NULL;
--#else
-- FILE *fp;
--#endif
-- int k_version = 0;
-+ int k_version;
- struct utsname myuname;
-
-+ /* check the kernel version */
-+ if ((uname(&myuname) != 0) || (myuname.release[0] != '2'))
-+ return EINVAL;
-+
-+ k_version = myuname.release[2] - '0';
-+ if (k_version > 4)
-+ return ENOTSUP;
-+
- /* Parse any options */
- getopt32(argv, OPTION_STR, &opt_o);
- arg1 = argv[optind];
- if (option_mask32 & OPT_o) { // -o /* name the output module */
-- free(m_name);
- m_name = xstrdup(opt_o);
- }
-
-- if (arg1 == NULL) {
-+ if (arg1 == NULL)
- bb_show_usage();
-- }
--
-- /* Grab the module name */
-- tmp1 = xstrdup(arg1);
-- tmp = basename(tmp1);
-- len = strlen(tmp);
--
-- if (uname(&myuname) == 0) {
-- if (myuname.release[0] == '2') {
-- k_version = myuname.release[2] - '0';
-- }
-- }
-
--#if ENABLE_FEATURE_2_6_MODULES
-- if (k_version > 4 && len > 3 && tmp[len - 3] == '.'
-- && tmp[len - 2] == 'k' && tmp[len - 1] == 'o'
-- ) {
-- len -= 3;
-- tmp[len] = '\0';
-- } else
--#endif
-- if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') {
-- len -= 2;
-- tmp[len] = '\0';
-- }
--
--
--#if ENABLE_FEATURE_2_6_MODULES
-- if (k_version > 4)
-- m_fullName = xasprintf("%s.ko", tmp);
-- else
--#endif
-- m_fullName = xasprintf("%s.o", tmp);
-+ ret = find_module(arg1);
-+ if (ret)
-+ goto out;
-
- if (!m_name) {
-- m_name = tmp;
-- } else {
-- free(tmp1);
-- tmp1 = NULL; /* flag for free(m_name) before exit() */
-- }
--
-- /* Get a filedesc for the module. Check that we have a complete path */
-- if (stat(arg1, &st) < 0 || !S_ISREG(st.st_mode)
-- || (fp = fopen_for_read(arg1)) == NULL
-- ) {
-- /* Hmm. Could not open it. First search under /lib/modules/`uname -r`,
-- * but do not error out yet if we fail to find it... */
-- if (k_version) { /* uname succeedd */
-- char *module_dir;
-- char *tmdn;
--
-- tmdn = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, myuname.release);
-- /* Jump through hoops in case /lib/modules/`uname -r`
-- * is a symlink. We do not want recursive_action to
-- * follow symlinks, but we do want to follow the
-- * /lib/modules/`uname -r` dir, So resolve it ourselves
-- * if it is a link... */
-- module_dir = xmalloc_readlink(tmdn);
-- if (!module_dir)
-- module_dir = xstrdup(tmdn);
-- recursive_action(module_dir, ACTION_RECURSE,
-- check_module_name_match, NULL, m_fullName, 0);
-- free(module_dir);
-- free(tmdn);
-- }
--
-- /* Check if we have found anything yet */
-- if (!m_filename || ((fp = fopen_for_read(m_filename)) == NULL)) {
-- int r;
-- char *module_dir;
--
-- free(m_filename);
-- m_filename = NULL;
-- module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR);
-- if (!module_dir)
-- module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR);
-- /* No module found under /lib/modules/`uname -r`, this
-- * time cast the net a bit wider. Search /lib/modules/ */
-- r = recursive_action(module_dir, ACTION_RECURSE,
-- check_module_name_match, NULL, m_fullName, 0);
-- if (r)
-- bb_error_msg_and_die("%s: module not found", m_fullName);
-- free(module_dir);
-- if (m_filename == NULL
-- || ((fp = fopen_for_read(m_filename)) == NULL)
-- ) {
-- bb_error_msg_and_die("%s: module not found", m_fullName);
-- }
-+ tmp = xstrdup(arg1);
-+ m_name = basename(tmp);
- }
-- } else
-- m_filename = xstrdup(arg1);
--
-- if (flag_verbose)
-- printf("Using %s\n", m_filename);
-
--#if ENABLE_FEATURE_2_6_MODULES
-- if (k_version > 4) {
-- argv[optind] = m_filename;
-- optind--;
-- return insmod_ng_main(argc - optind, argv + optind);
-+ fp = fopen_for_read(g_filename);
-+ if (!fp) {
-+ ret = errno;
-+ goto out;
- }
--#endif
-
- f = obj_load(fp, LOADBITS);
-
-@@ -4087,7 +4058,7 @@ int insmod_main(int argc, char **argv)
- "\t%s was compiled for kernel version %s\n"
- "\twhile this kernel is version %s",
- flag_force_load ? "warning: " : "",
-- m_filename, m_strversion, uts_info.release);
-+ g_filename, m_strversion, uts_info.release);
- if (!flag_force_load)
- goto out;
- }
-@@ -4129,7 +4100,7 @@ int insmod_main(int argc, char **argv)
- hide_special_symbols(f);
-
- #if ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS
-- add_ksymoops_symbols(f, m_filename, m_name);
-+ add_ksymoops_symbols(f, g_filename, m_name);
- #endif /* FEATURE_INSMOD_KSYMOOPS_SYMBOLS */
-
- new_create_module_ksymtab(f);
-@@ -4138,7 +4109,7 @@ int insmod_main(int argc, char **argv)
- m_size = obj_load_size(f);
-
- m_addr = create_module(m_name, m_size);
-- if (m_addr == (ElfW(Addr))(-1)) switch (errno) {
-+ if (m_addr == -1) switch (errno) {
- case EEXIST:
- bb_error_msg_and_die("a module named %s already exists", m_name);
- case ENOMEM:
-@@ -4154,36 +4125,37 @@ int insmod_main(int argc, char **argv)
- * now we can load them directly into the kernel memory
- */
- if (!obj_load_progbits(fp, f, (char*)m_addr)) {
-- delete_module(m_name, 0);
-+ delete_module(m_name);
- goto out;
- }
- #endif
-
- if (!obj_relocate(f, m_addr)) {
-- delete_module(m_name, 0);
-+ delete_module(m_name);
- goto out;
- }
-
- if (!new_init_module(m_name, f, m_size)) {
-- delete_module(m_name, 0);
-+ delete_module(m_name);
- goto out;
- }
-
- if (flag_print_load_map)
- print_load_map(f);
-
-- exit_status = EXIT_SUCCESS;
-+ ret = EXIT_SUCCESS;
-
- out:
- #if ENABLE_FEATURE_CLEAN_UP
- if (fp)
- fclose(fp);
-- free(tmp1);
-- if (!tmp1)
-+ if (tmp)
-+ free(tmp);
-+ else if (m_name)
- free(m_name);
-- free(m_filename);
-+ free(g_filename);
- #endif
-- return exit_status;
+ return ret;
- }
-
- #endif /* ENABLE_FEATURE_2_4_MODULES */
-@@ -4195,15 +4167,8 @@ int insmod_main(int argc, char **argv)
- #if ENABLE_FEATURE_2_6_MODULES
-
- #include <sys/mman.h>
--
--#if defined __UCLIBC__ && !ENABLE_FEATURE_2_4_MODULES
--/* big time suckage. The old prototype above renders our nice fwd-decl wrong */
--extern int init_module(void *module, unsigned long len, const char *options);
--#else
- #include <asm/unistd.h>
- #include <sys/syscall.h>
--#define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
--#endif
-
- /* We use error numbers in a loose translation... */
- static const char *moderror(int err)
-@@ -4222,22 +4187,32 @@ static const char *moderror(int err)
- }
- }
-
--#if !ENABLE_FEATURE_2_4_MODULES
--int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
--int insmod_main(int argc UNUSED_PARAM, char **argv)
--#else
--static int insmod_ng_main(int argc UNUSED_PARAM, char **argv)
--#endif
-+int insmod_main_26(int argc, char **argv)
- {
-- size_t len;
-+ char *filename, *options;
-+ struct utsname myuname;
-+ int k_version;
- int optlen;
-+ size_t len;
- void *map;
-- char *filename, *options;
-+ long ret = 0;
-+
-+ /* check the kernel version */
-+ if ((uname(&myuname) != 0) || (myuname.release[0] != '2'))
-+ return EINVAL;
-+
-+ k_version = myuname.release[2] - '0';
-+ if (k_version <= 4)
-+ return ENOTSUP;
++}
- filename = *++argv;
+ int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int insmod_main(int argc UNUSED_PARAM, char **argv)
+@@ -25,9 +118,14 @@ int insmod_main(int argc UNUSED_PARAM, c
if (!filename)
bb_show_usage();
-+ ret = find_module(filename);
-+ if (ret || (g_filename == NULL))
-+ goto done;
+- rc = bb_init_module(filename, parse_cmdline_module_options(argv));
++ rc = find_module(filename);
++ if (rc || (g_filename == NULL))
++ goto done;
+
- /* Rest is options */
- options = xzalloc(1);
- optlen = 0;
-@@ -4247,41 +4222,47 @@ static int insmod_ng_main(int argc UNUSE
- optlen += sprintf(options + optlen, (strchr(*argv,' ') ? "\"%s\" " : "%s "), *argv);
- }
-
--#if 0
-- /* Any special reason why mmap? It isn't performance critical. -vda */
-- /* Yes, xmalloc'ing can use *alot* of RAM. Don't forget that there are
-- * modules out there that are half a megabyte! mmap()ing is way nicer
-- * for small mem boxes, i guess. */
-- /* But after load, these modules will take up that 0.5mb in kernel
-- * anyway. Using malloc here causes only a transient spike to 1mb,
-- * after module is loaded, we go back to normal 0.5mb usage
-- * (in kernel). Also, mmap isn't magic - when we touch mapped data,
-- * we use memory. -vda */
-- int fd;
-- struct stat st;
-- unsigned long len;
-- fd = xopen(filename, O_RDONLY);
-- fstat(fd, &st);
-- len = st.st_size;
-- map = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
-- if (map == MAP_FAILED) {
-- bb_perror_msg_and_die("cannot mmap '%s'", filename);
-- }
++ rc = bb_init_module(g_filename, parse_cmdline_module_options(argv));
+ if (rc)
+ bb_error_msg("cannot insert '%s': %s", filename, moderror(rc));
-
-- /* map == NULL on Blackfin, probably on other MMU-less systems too. Workaround. */
-- if (map == NULL) {
-- map = xmalloc(len);
-- xread(fd, map, len);
-- }
--#else
- len = MAXINT(ssize_t);
-- map = xmalloc_xopen_read_close(filename, &len);
--#endif
-+ map = xmalloc_open_read_close(g_filename, &len);
-+ ret = syscall(__NR_init_module, map, len, options);
-+ if (ret != 0) {
-+ bb_perror_msg_and_die("cannot insert '%s': %s (%li)",
-+ g_filename, moderror(errno), ret);
-+ }
++ free (g_filename);
+done:
-+ if (g_filename && (g_filename != filename))
-+ free(g_filename);
-
-- if (init_module(map, len, options) != 0)
-- bb_error_msg_and_die("cannot insert '%s': %s",
-- filename, moderror(errno));
-- return 0;
-+ return ret;
+ return rc;
}
-
- #endif
-+
-+int insmod_main(int argc, char **argv)
-+{
-+ int ret;
-+
-+ g_filename = NULL;
-+#if ENABLE_FEATURE_2_6_MODULES
-+ ret = insmod_main_26(argc, argv);
-+ if (ret != ENOTSUP)
-+ goto done;
-+#endif
-+
-+#if ENABLE_FEATURE_2_4_MODULES
-+ ret = insmod_main_24(argc, argv);
-+ if (ret != ENOTSUP)
-+ goto done;
-+#endif
-+
-+ fprintf(stderr, "Error: Kernel version not supported\n");
-+ return 1;
-+
-+done:
-+ if (ret) {
-+ errno = ret;
-+ bb_perror_msg("Loading module failed");
-+ return ret;
-+ } else
-+ return 0;
-+}
diff --git a/package/busybox/patches/480-vi_search.patch b/package/busybox/patches/480-vi_search.patch
deleted file mode 100644
index 1281135d2b..0000000000
--- a/package/busybox/patches/480-vi_search.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- a/editors/vi.c
-+++ b/editors/vi.c
-@@ -3317,7 +3317,7 @@ static void do_cmd(char c)
- buf[1] = '\0';
- q = get_input_line(buf); // get input line- use "status line"
- if (q[0] && !q[1]) {
-- if (last_search_pattern[0])
-+ if (last_search_pattern)
- last_search_pattern[0] = c;
- goto dc3; // if no pat re-use old pat
- }
-@@ -3333,6 +3333,10 @@ static void do_cmd(char c)
- if (cmdcnt-- > 1) {
- do_cmd(c);
- } // repeat cnt
-+ if (last_search_pattern == 0) {
-+ msg = "No previous regular expression";
-+ goto dc2;
-+ }
- dir = BACK; // assume BACKWARD search
- p = dot - 1;
- if (last_search_pattern[0] == '?') {
diff --git a/package/busybox/patches/510-awk_include.patch b/package/busybox/patches/510-awk_include.patch
index b185408a99..7284bbcac6 100644
--- a/package/busybox/patches/510-awk_include.patch
+++ b/package/busybox/patches/510-awk_include.patch
@@ -15,7 +15,7 @@
} func;
/* I/O stream */
-@@ -1400,7 +1405,8 @@ static void parse_program(char *p)
+@@ -1423,7 +1428,8 @@ static void parse_program(char *p)
next_token(TC_FUNCTION);
g_pos++;
f = newfunc(t_string);
@@ -25,7 +25,7 @@
f->nargs = 0;
while (next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) {
v = findvar(ahash, t_string);
-@@ -1409,7 +1415,7 @@ static void parse_program(char *p)
+@@ -1432,7 +1438,7 @@ static void parse_program(char *p)
if (next_token(TC_COMMA | TC_SEQTERM) & TC_SEQTERM)
break;
}
@@ -34,7 +34,7 @@
chain_group();
clear_array(ahash);
-@@ -2374,7 +2380,8 @@ static var *evaluate(node *op, var *res)
+@@ -2397,7 +2403,8 @@ static var *evaluate(node *op, var *res)
break;
case XC( OC_FUNC ):
@@ -44,7 +44,7 @@
syntax_error(EMSG_UNDEF_FUNC);
X.v = R.v = nvalloc(op->r.f->nargs+1);
-@@ -2391,7 +2398,10 @@ static var *evaluate(node *op, var *res)
+@@ -2414,7 +2421,10 @@ static var *evaluate(node *op, var *res)
fnargs = X.v;
L.s = g_progname;
@@ -56,7 +56,7 @@
g_progname = L.s;
nvfree(fnargs);
-@@ -2754,6 +2764,143 @@ static rstream *next_input_file(void)
+@@ -2777,6 +2787,143 @@ static rstream *next_input_file(void)
#undef files_happen
}
@@ -200,7 +200,7 @@
int awk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int awk_main(int argc, char **argv)
{
-@@ -2819,6 +2966,9 @@ int awk_main(int argc, char **argv)
+@@ -2842,6 +2989,9 @@ int awk_main(int argc, char **argv)
*s1 = '=';
}
}
diff --git a/package/busybox/patches/530-unsigned_bitwise_ops.patch b/package/busybox/patches/530-unsigned_bitwise_ops.patch
deleted file mode 100644
index e69de29bb2..0000000000
--- a/package/busybox/patches/530-unsigned_bitwise_ops.patch
+++ /dev/null
diff --git a/package/busybox/patches/803-id_getgrouplist.patch b/package/busybox/patches/803-id_getgrouplist.patch
new file mode 100644
index 0000000000..ddc89f269b
--- /dev/null
+++ b/package/busybox/patches/803-id_getgrouplist.patch
@@ -0,0 +1,49 @@
+This patch disable supplementary groups handling in id with uClibc versions
+prior to v0.9.30, which are lacking the 'getgrouplist' function.
+
+Signed-off-by: Nicolas Thill <nico@openwrt.org>
+
+--- a/coreutils/id.c
++++ b/coreutils/id.c
+@@ -17,10 +17,12 @@
+
+ #include "libbb.h"
+
++#define HAVE_GETGROUPLIST 1
++
+ #if !ENABLE_USE_BB_PWD_GRP
+ #if defined(__UCLIBC_MAJOR__) && (__UCLIBC_MAJOR__ == 0)
+ #if (__UCLIBC_MINOR__ < 9) || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 30)
+-#error "Sorry, you need at least uClibc version 0.9.30 for id applet to build"
++#undef HAVE_GETGROUPLIST
+ #endif
+ #endif
+ #endif
+@@ -86,7 +88,11 @@ static int get_groups(const char *userna
+ /* If the user is a member of more than
+ * *n groups, then -1 is returned. Otherwise >= 0.
+ * (and no defined way of detecting errors?!) */
++#if HAVE_GETGROUPLIST
+ m = getgrouplist(username, rgid, groups, n);
++#else
++ *n = -1;
++#endif
+ /* I guess *n < 0 might indicate error. Anyway,
+ * malloc'ing -1 bytes won't be good, so: */
+ //if (*n < 0)
+@@ -160,6 +166,7 @@ int id_main(int argc UNUSED_PARAM, char
+ if (egid != rgid)
+ status |= print_group(egid, " ");
+ }
++#if HAVE_GETGROUPLIST
+ /* We are supplying largish buffer, trying
+ * to not run get_groups() twice. That might be slow
+ * ("user database in remote SQL server" case) */
+@@ -187,6 +194,7 @@ int id_main(int argc UNUSED_PARAM, char
+ }
+ if (ENABLE_FEATURE_CLEAN_UP)
+ free(groups);
++#endif
+ #if ENABLE_SELINUX
+ if (is_selinux_enabled()) {
+ if (getcon(&scontext) == 0)
diff --git a/package/busybox/patches/810-lsmod-infinite-loop.patch b/package/busybox/patches/810-lsmod-infinite-loop.patch
deleted file mode 100644
index 8bc8cd0a76..0000000000
--- a/package/busybox/patches/810-lsmod-infinite-loop.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/modutils/lsmod.c
-+++ b/modutils/lsmod.c
-@@ -107,7 +107,7 @@
- continue;
- } else if (errno != ENOSPC)
- bb_perror_msg_and_die("module %s: QM_REFS", mn);
-- deps = xrealloc(deps, count);
-+ deps = xrealloc(deps, depsize = count);
- }
- printf("%-20s%8lu%4ld", mn, info.size, info.usecount);
- if (info.flags & NEW_MOD_DELETED)