--- /dev/null
+From be729c1d3b5c923f10871dd68ea94156d0f8c803 Mon Sep 17 00:00:00 2001
+From: Ari Sundholm <ari@tuxera.com>
+Date: Mon, 4 Jan 2016 15:40:37 +0200
+Subject: [PATCH] truncate: always set mode when opening file to avoid fortify
+ errors
+
+Busybox crashes due to no mode being given when opening:
+$ ./busybox truncate -s 1M foo
+*** invalid open64 call: O_CREAT without mode ***: ./busybox terminated
+======= Backtrace: =========
+/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f66d921338f]
+/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f66d92aac9c]
+/lib/x86_64-linux-gnu/libc.so.6(+0xeb6aa)[0x7f66d928b6aa]
+./busybox[0x4899f9]
+======= Memory map: ========
+00400000-004d0000 r-xp 00000000 00:1a 137559 /home/ari/busybox/busybox
+006cf000-006d0000 r--p 000cf000 00:1a 137559 /home/ari/busybox/busybox
+006d0000-006d1000 rw-p 000d0000 00:1a 137559 /home/ari/busybox/busybox
+006d1000-006d4000 rw-p 00000000 00:00 0
+014e7000-01508000 rw-p 00000000 00:00 0 [heap]
+7f66d8f8a000-7f66d8fa0000 r-xp 00000000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1
+7f66d8fa0000-7f66d919f000 ---p 00016000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1
+7f66d919f000-7f66d91a0000 rw-p 00015000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1
+7f66d91a0000-7f66d935b000 r-xp 00000000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
+7f66d935b000-7f66d955a000 ---p 001bb000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
+7f66d955a000-7f66d955e000 r--p 001ba000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
+7f66d955e000-7f66d9560000 rw-p 001be000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
+7f66d9560000-7f66d9565000 rw-p 00000000 00:00 0
+7f66d9565000-7f66d966a000 r-xp 00000000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
+7f66d966a000-7f66d9869000 ---p 00105000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
+7f66d9869000-7f66d986a000 r--p 00104000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
+7f66d986a000-7f66d986b000 rw-p 00105000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
+7f66d986b000-7f66d988e000 r-xp 00000000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so
+7f66d9a64000-7f66d9a67000 rw-p 00000000 00:00 0
+7f66d9a8a000-7f66d9a8d000 rw-p 00000000 00:00 0
+7f66d9a8d000-7f66d9a8e000 r--p 00022000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so
+7f66d9a8e000-7f66d9a8f000 rw-p 00023000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so
+7f66d9a8f000-7f66d9a90000 rw-p 00000000 00:00 0
+7ffc47761000-7ffc47782000 rw-p 00000000 00:00 0 [stack]
+7ffc477ab000-7ffc477ad000 r-xp 00000000 00:00 0 [vdso]
+ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
+Aborted (core dumped)
+$
+
+Fix this by simply always setting the mode, as it doesn't hurt even
+when O_CREAT is not specified.
+
+This bug is a regression introduced in fc3e40e, as xopen(), which
+was originally used, would automatically set the mode.
+
+Signed-off-by: Ari Sundholm <ari@tuxera.com>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+(cherry picked from commit e111a1640494fe87fc913f94fae3bb805de0fc99)
+---
+ coreutils/truncate.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/coreutils/truncate.c b/coreutils/truncate.c
+index e5fa656..4c997bf 100644
+--- a/coreutils/truncate.c
++++ b/coreutils/truncate.c
+@@ -64,7 +64,7 @@ int truncate_main(int argc UNUSED_PARAM, char **argv)
+
+ argv += optind;
+ while (*argv) {
+- int fd = open(*argv, flags);
++ int fd = open(*argv, flags, 0666);
+ if (fd < 0) {
+ if (errno != ENOENT || !(opts & OPT_NOCREATE)) {
+ bb_perror_msg("%s: open", *argv);
+--
+2.6.2
+
--- /dev/null
+From 092fabcf1df5d46cd22be4ffcd3b871f6180eb9c Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Fri, 30 Oct 2015 23:41:53 +0100
+Subject: [PATCH] [g]unzip: fix recent breakage.
+
+Also, do emit error message we so painstakingly pass from gzip internals
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+(cherry picked from commit 6bd3fff51aa74e2ee2d87887b12182a3b09792ef)
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ archival/libarchive/decompress_gunzip.c | 33 +++++++++++++++++++++------------
+ testsuite/unzip.tests | 1 +
+ 2 files changed, 22 insertions(+), 12 deletions(-)
+
+diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
+index c76fd31..357c9bf 100644
+--- a/archival/libarchive/decompress_gunzip.c
++++ b/archival/libarchive/decompress_gunzip.c
+@@ -309,8 +309,7 @@ static int huft_build(const unsigned *b, const unsigned n,
+ huft_t *q; /* points to current table */
+ huft_t r; /* table entry for structure assignment */
+ huft_t *u[BMAX]; /* table stack */
+- unsigned v[N_MAX]; /* values in order of bit length */
+- unsigned v_end;
++ unsigned v[N_MAX + 1]; /* values in order of bit length. last v[] is never used */
+ int ws[BMAX + 1]; /* bits decoded stack */
+ int w; /* bits decoded */
+ unsigned x[BMAX + 1]; /* bit offsets, then code stack */
+@@ -365,15 +364,17 @@ static int huft_build(const unsigned *b, const unsigned n,
+ *xp++ = j;
+ }
+
+- /* Make a table of values in order of bit lengths */
++ /* Make a table of values in order of bit lengths.
++ * To detect bad input, unused v[i]'s are set to invalid value UINT_MAX.
++ * In particular, last v[i] is never filled and must not be accessed.
++ */
++ memset(v, 0xff, sizeof(v));
+ p = b;
+ i = 0;
+- v_end = 0;
+ do {
+ j = *p++;
+ if (j != 0) {
+ v[x[j]++] = i;
+- v_end = x[j];
+ }
+ } while (++i < n);
+
+@@ -435,7 +436,9 @@ static int huft_build(const unsigned *b, const unsigned n,
+
+ /* set up table entry in r */
+ r.b = (unsigned char) (k - w);
+- if (p >= v + v_end) { // Was "if (p >= v + n)" but v[] can be shorter!
++ if (/*p >= v + n || -- redundant, caught by the second check: */
++ *p == UINT_MAX /* do we access uninited v[i]? (see memset(v))*/
++ ) {
+ r.e = 99; /* out of values--invalid code */
+ } else if (*p < s) {
+ r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is EOB code */
+@@ -520,8 +523,9 @@ static NOINLINE int inflate_codes(STATE_PARAM_ONLY)
+ e = t->e;
+ if (e > 16)
+ do {
+- if (e == 99)
+- abort_unzip(PASS_STATE_ONLY);;
++ if (e == 99) {
++ abort_unzip(PASS_STATE_ONLY);
++ }
+ bb >>= t->b;
+ k -= t->b;
+ e -= 16;
+@@ -557,8 +561,9 @@ static NOINLINE int inflate_codes(STATE_PARAM_ONLY)
+ e = t->e;
+ if (e > 16)
+ do {
+- if (e == 99)
++ if (e == 99) {
+ abort_unzip(PASS_STATE_ONLY);
++ }
+ bb >>= t->b;
+ k -= t->b;
+ e -= 16;
+@@ -824,8 +829,9 @@ static int inflate_block(STATE_PARAM smallint *e)
+
+ b_dynamic >>= 4;
+ k_dynamic -= 4;
+- if (nl > 286 || nd > 30)
++ if (nl > 286 || nd > 30) {
+ abort_unzip(PASS_STATE_ONLY); /* bad lengths */
++ }
+
+ /* read in bit-length-code lengths */
+ for (j = 0; j < nb; j++) {
+@@ -906,12 +912,14 @@ static int inflate_block(STATE_PARAM smallint *e)
+ bl = lbits;
+
+ i = huft_build(ll, nl, 257, cplens, cplext, &inflate_codes_tl, &bl);
+- if (i != 0)
++ if (i != 0) {
+ abort_unzip(PASS_STATE_ONLY);
++ }
+ bd = dbits;
+ i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &inflate_codes_td, &bd);
+- if (i != 0)
++ if (i != 0) {
+ abort_unzip(PASS_STATE_ONLY);
++ }
+
+ /* set up data for inflate_codes() */
+ inflate_codes_setup(PASS_STATE bl, bd);
+@@ -999,6 +1007,7 @@ inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate)
+ error_msg = "corrupted data";
+ if (setjmp(error_jmp)) {
+ /* Error from deep inside zip machinery */
++ bb_error_msg(error_msg);
+ n = -1;
+ goto ret;
+ }
+diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
+index ca0a458..d8738a3 100755
+--- a/testsuite/unzip.tests
++++ b/testsuite/unzip.tests
+@@ -34,6 +34,7 @@ rm foo.zip
+ testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
+ "Archive: bad.zip
+ inflating: ]3j½r«I\e\12K-%Ix
++unzip: corrupted data
+ unzip: inflate error
+ 1
+ " \
+--
+2.6.2
+
--- /dev/null
+From 1de25a6e87e0e627aa34298105a3d17c60a1f44e Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Mon, 26 Oct 2015 19:33:05 +0100
+Subject: [PATCH] unzip: test for bad archive SEGVing
+
+function old new delta
+huft_build 1296 1300 +4
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ archival/libarchive/decompress_gunzip.c | 11 +++++++----
+ testsuite/unzip.tests | 23 ++++++++++++++++++++++-
+ 2 files changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
+index 7b6f459..30bf451 100644
+--- a/archival/libarchive/decompress_gunzip.c
++++ b/archival/libarchive/decompress_gunzip.c
+@@ -305,11 +305,12 @@ static int huft_build(const unsigned *b, const unsigned n,
+ unsigned i; /* counter, current code */
+ unsigned j; /* counter */
+ int k; /* number of bits in current code */
+- unsigned *p; /* pointer into c[], b[], or v[] */
++ const unsigned *p; /* pointer into c[], b[], or v[] */
+ huft_t *q; /* points to current table */
+ huft_t r; /* table entry for structure assignment */
+ huft_t *u[BMAX]; /* table stack */
+ unsigned v[N_MAX]; /* values in order of bit length */
++ unsigned v_end;
+ int ws[BMAX + 1]; /* bits decoded stack */
+ int w; /* bits decoded */
+ unsigned x[BMAX + 1]; /* bit offsets, then code stack */
+@@ -324,7 +325,7 @@ static int huft_build(const unsigned *b, const unsigned n,
+
+ /* Generate counts for each bit length */
+ memset(c, 0, sizeof(c));
+- p = (unsigned *) b; /* cast allows us to reuse p for pointing to b */
++ p = b;
+ i = n;
+ do {
+ c[*p]++; /* assume all entries <= BMAX */
+@@ -365,12 +366,14 @@ static int huft_build(const unsigned *b, const unsigned n,
+ }
+
+ /* Make a table of values in order of bit lengths */
+- p = (unsigned *) b;
++ p = b;
+ i = 0;
++ v_end = 0;
+ do {
+ j = *p++;
+ if (j != 0) {
+ v[x[j]++] = i;
++ v_end = x[j];
+ }
+ } while (++i < n);
+
+@@ -432,7 +435,7 @@ static int huft_build(const unsigned *b, const unsigned n,
+
+ /* set up table entry in r */
+ r.b = (unsigned char) (k - w);
+- if (p >= v + n) {
++ if (p >= v + v_end) { // Was "if (p >= v + n)" but v[] can be shorter!
+ r.e = 99; /* out of values--invalid code */
+ } else if (*p < s) {
+ r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is EOB code */
+diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
+index 8677a03..ca0a458 100755
+--- a/testsuite/unzip.tests
++++ b/testsuite/unzip.tests
+@@ -7,7 +7,7 @@
+
+ . ./testing.sh
+
+-# testing "test name" "options" "expected result" "file input" "stdin"
++# testing "test name" "commands" "expected result" "file input" "stdin"
+ # file input will be file called "input"
+ # test can create a file "actual" instead of writing to stdout
+
+@@ -30,6 +30,27 @@ testing "unzip (subdir only)" "unzip -q foo.zip foo/ && test -d foo && test ! -f
+ rmdir foo
+ rm foo.zip
+
++# File containing some damaged encrypted stream
++testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
++"Archive: bad.zip
++ inflating: ]3j½r«I\e\12K-%Ix
++unzip: inflate error
++1
++" \
++"" "\
++begin-base64 644 bad.zip
++UEsDBBQAAgkIAAAAIQA5AAAANwAAADwAAAAQAAcAXTNqwr1ywqtJGxJLLSVJ
++eCkBD0AdKBk8JzQsIj01JC0/ORJQSwMEFAECCAAAAAAhADoAAAAPAAAANgAA
++AAwAAQASw73Ct1DCokohPXQiNjoUNTUiHRwgLT4WHlBLAQIQABQAAggIAAAA
++oQA5AAAANwAAADwAAAAQQAcADAAAACwAMgCAAAAAAABdM2rCvXLCq0kbEkst
++JUl4KQEPQB0oGSY4Cz4QNgEnJSYIPVBLAQIAABQAAggAAAAAIQAqAAAADwAA
++BDYAAAAMAAEADQAAADIADQAAAEEAAAASw73Ct1DKokohPXQiNzA+FAI1HCcW
++NzITNFBLBQUKAC4JAA04Cw0EOhZQSwUGAQAABAIAAgCZAAAAeQAAAAIALhM=
++====
++"
++
++rm *
++
+ # Clean up scratch directory.
+
+ cd ..
+--
+2.6.2
+
--- /dev/null
+diff -Naur busybox-1.22.1/init/init.c busybox-1.22.1/init/init.c
+--- busybox-1.22.1/init/init.c 2011-09-06 04:35:17.000000000 +0200
++++ busybox-1.22.1/init/init.c 2011-11-14 14:39:06.000000000 +0100
+@@ -262,6 +262,11 @@
+ }
+ }
+
++#ifdef VT_OPENQRY
++/* don't want that "vt102" stuff... */
++#undef VT_OPENQRY
++#endif
++
+ static void console_init(void)
+ {
+ #ifdef VT_OPENQRY
+@@ -269,16 +274,23 @@
+ #endif
+ char *s;
+
++# if 0
+ s = getenv("CONSOLE");
+ if (!s)
+ s = getenv("console");
++#endif
++ s = "/dev/console";
++ mknod(s, (S_IFCHR | 0600), 0x0501);
++
+ if (s) {
++ close(STDIN_FILENO);
++ /* we'll get STDIN_FILENO from open... */
+ int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY);
+ if (fd >= 0) {
+- dup2(fd, STDIN_FILENO);
+ dup2(fd, STDOUT_FILENO);
+- xmove_fd(fd, STDERR_FILENO);
++ dup2(fd, STDERR_FILENO);
+ }
++ ndelay_off(STDIN_FILENO);
+ dbg_message(L_LOG, "console='%s'", s);
+ } else {
+ /* Make sure fd 0,1,2 are not closed
+@@ -295,8 +307,8 @@
+ /* Not a linux terminal, probably serial console.
+ * Force the TERM setting to vt102
+ * if TERM is set to linux (the default) */
+- if (!s || strcmp(s, "linux") == 0)
+- putenv((char*)"TERM=vt102");
++/* if (!s || strcmp(s, "linux") == 0)
++ putenv((char*)"TERM=vt102"); */
+ if (!ENABLE_FEATURE_INIT_SYSLOG)
+ log_console = NULL;
+ } else
--- /dev/null
+--- a/networking/ifupdown.org.c 2013-02-15 11:36:01.000000000 +0100
++++ b/networking/ifupdown.c 2013-02-15 11:37:57.000000000 +0100
+@@ -534,7 +534,7 @@
+ "pump -i %iface% -k",
+ },
+ { "udhcpc",
+- "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %client%]]"
++ "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -x hostname:%hostname%]][[ -c %client%]]"
+ "[[ -s %script%]][[ %udhcpc_opts%]]",
+ "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
+ },
+@@ -574,7 +574,7 @@
+ return 0;
+ # endif
+ return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid "
+- "-i %iface%[[ -H %hostname%]][[ -c %client%]][[ -s %script%]][[ %udhcpc_opts%]]",
++ "-i %iface%[[ -x hostname:%hostname%]][[ -c %client%]][[ -s %script%]][[ %udhcpc_opts%]]",
+ ifd, exec);
+ }
+ # else
--- /dev/null
+For details of this patch see https://bugs.busybox.net/show_bug.cgi?id=6806
+
+Simon Edlund
+The problem seems to be the symlink /sys/block/mtdblockX/device
+which points to /sys/class/mtd/mtdX, which exists on some kernels (i.e. 2.6.31)
+When mdev -s traverses the /sys directory looking for "dev" files,
+it starts with the block devices under /sys/block, and will find the "dev" file
+through the symlink, and create a block device node.
+In the next stage it will scan the /sys/class looking for char devices,
+and will find mtdX/dev again, but this time the mknod will fail because there
+is already a device node with that name.
+I fixed this by having mdev -s scan the /sys/class before /sys/block,
+whether this is the best way, someone else with a deeper knowledge
+of the /sys directory hierarchy will have to judge.
+
+gregory.0xf0
+I believe this patch is a good approach.
+Also, it appears that this is only a problem when both
+CONFIG_SYSFS_DEPRECATED and CONFIG_SYSFS_DEPRECATED_V2 are set.
+
+--- a/util-linux/mdev.c
++++ b/util-linux/mdev.c
+@@ -1066,6 +1066,9 @@
+
+ putenv((char*)"ACTION=add");
+
++ recursive_action("/sys/class",
++ ACTION_RECURSE | ACTION_FOLLOWLINKS,
++ fileAction, dirAction, temp, 0);
+ /* ACTION_FOLLOWLINKS is needed since in newer kernels
+ * /sys/block/loop* (for example) are symlinks to dirs,
+ * not real directories.
+@@ -1082,9 +1085,6 @@
+ ACTION_RECURSE | ACTION_FOLLOWLINKS | ACTION_QUIET,
+ fileAction, dirAction, temp, 0);
+ }
+- recursive_action("/sys/class",
+- ACTION_RECURSE | ACTION_FOLLOWLINKS,
+- fileAction, dirAction, temp, 0);
+ } else {
+ char *fw;
+ char *seq;
--- /dev/null
+--- a/util-linux/mdev.c
++++ b/util-linux/mdev.c
+@@ -887,11 +887,20 @@
+ int firmware_fd, loading_fd;
+
+ /* check for /lib/firmware/$FIRMWARE */
+- xchdir("/lib/firmware");
+- firmware_fd = open(firmware, O_RDONLY); /* can fail */
++ if (chdir("/lib/firmware")) {
++ /* don't die -- might need to write mdev.seq */
++ bb_perror_msg("chdir(/lib/firmware)");
++ return;
++ }
++ firmware_fd = xopen(firmware, O_RDONLY);
++ loading_fd = -1;
+
+ /* check for /sys/$DEVPATH/loading ... give 30 seconds to appear */
+- xchdir(sysfs_path);
++ if (chdir(sysfs_path)) {
++ bb_perror_msg("chdir(%s)", sysfs_path); /* crappy driver... */
++ goto out;
++ }
++
+ for (cnt = 0; cnt < 30; ++cnt) {
+ loading_fd = open("loading", O_WRONLY);
+ if (loading_fd >= 0)
+@@ -964,7 +973,7 @@
+ {
+ /* We time out after 2 sec */
+ static const struct timespec ts = { 0, 32*1000*1000 };
+- int timeout = 2000 / 32;
++ int timeout = 5000 / 32;
+ int seq_fd = -1;
+ int do_once = 1;
+ sigset_t set_CHLD;
+++ /dev/null
-diff -Naur busybox-1.22.1/init/init.c busybox-1.22.1/init/init.c
---- busybox-1.22.1/init/init.c 2011-09-06 04:35:17.000000000 +0200
-+++ busybox-1.22.1/init/init.c 2011-11-14 14:39:06.000000000 +0100
-@@ -262,6 +262,11 @@
- }
- }
-
-+#ifdef VT_OPENQRY
-+/* don't want that "vt102" stuff... */
-+#undef VT_OPENQRY
-+#endif
-+
- static void console_init(void)
- {
- #ifdef VT_OPENQRY
-@@ -269,16 +274,23 @@
- #endif
- char *s;
-
-+# if 0
- s = getenv("CONSOLE");
- if (!s)
- s = getenv("console");
-+#endif
-+ s = "/dev/console";
-+ mknod(s, (S_IFCHR | 0600), 0x0501);
-+
- if (s) {
-+ close(STDIN_FILENO);
-+ /* we'll get STDIN_FILENO from open... */
- int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY);
- if (fd >= 0) {
-- dup2(fd, STDIN_FILENO);
- dup2(fd, STDOUT_FILENO);
-- xmove_fd(fd, STDERR_FILENO);
-+ dup2(fd, STDERR_FILENO);
- }
-+ ndelay_off(STDIN_FILENO);
- dbg_message(L_LOG, "console='%s'", s);
- } else {
- /* Make sure fd 0,1,2 are not closed
-@@ -295,8 +307,8 @@
- /* Not a linux terminal, probably serial console.
- * Force the TERM setting to vt102
- * if TERM is set to linux (the default) */
-- if (!s || strcmp(s, "linux") == 0)
-- putenv((char*)"TERM=vt102");
-+/* if (!s || strcmp(s, "linux") == 0)
-+ putenv((char*)"TERM=vt102"); */
- if (!ENABLE_FEATURE_INIT_SYSLOG)
- log_console = NULL;
- } else
-diff -Naur busybox-1.22.1/modutils/Config.src busybox-1.22.1/modutils/Config.src
---- busybox-1.22.1/modutils/Config.src 2011-09-06 04:35:17.000000000 +0200
-+++ busybox-1.22.1/modutils/Config.src 2011-11-14 14:39:06.000000000 +0100
-@@ -247,7 +247,7 @@
- config DEFAULT_MODULES_DIR
- string "Default directory containing modules"
- default "/lib/modules"
-- depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO
-+ depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO || INSMOD
- help
- Directory that contains kernel modules.
- Defaults to "/lib/modules"
-diff -Naur busybox-1.22.1/modutils/insmod.c busybox-1.22.1/modutils/insmod.c
---- busybox-1.22.1/modutils/insmod.c 2011-09-06 04:35:17.000000000 +0200
-+++ busybox-1.22.1/modutils/insmod.c 2011-11-14 14:50:30.000000000 +0100
-@@ -35,11 +35,42 @@
- //usage: )
- //usage:#endif
-
-+#include <sys/utsname.h>
-+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;
-+}
-+
- int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int insmod_main(int argc UNUSED_PARAM, char **argv)
- {
- char *filename;
- int rc;
-+int len;
-+char *tmp;
-+char *tmp2;
-+int k_version = 0;
-+struct stat st;
-+struct utsname uts;
-+char *m_name;
-+FILE *fp;
-
- /* Compat note:
- * 2.6 style insmod has no options and required filename
-@@ -58,9 +89,99 @@
- if (!filename)
- bb_show_usage();
-
-- rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0));
-+ /* Grab the module name */
-+ tmp = xstrdup(filename);
-+ len = strlen(filename);
-+
-+ if (uname(&uts) == 0) {
-+ if (uts.release[0] == '2') {
-+ k_version = uts.release[2] - '0';
-+ }
-+ }
-+
-+ if (k_version > 4 && len > 3 && tmp[len - 3] == '.'
-+ && tmp[len - 2] == 'k' && tmp[len - 1] == 'o'
-+ ) {
-+ len -= 3;
-+ tmp[len] = '\0';
-+ } else
-+ if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') {
-+ len -= 2;
-+ tmp[len] = '\0';
-+ }
-+
-+ if (k_version > 4)
-+ m_fullName = xasprintf("%s.ko", tmp);
-+ else
-+ m_fullName = xasprintf("%s.o", tmp);
-+
-+ if (!m_name) {
-+ m_name = tmp;
-+ }
-+ free(tmp);
-+
-+ /* first look in /var/lib/modules */
-+ tmp2 = alloca(strlen(m_fullName) + sizeof("/var/lib/modules/"));
-+ strcpy(tmp2, "/var/lib/modules/");
-+ strcat(tmp2, m_fullName);
-+ if (stat(tmp2, &st) >= 0 && S_ISREG(st.st_mode) && (fp = fopen(tmp2, "r")) != NULL) {
-+ m_filename = xstrdup(tmp2);
-+ printf("insmod: preferring module %s\n", m_filename);
-+ } else
-+ /* Get a filedesc for the module. Check that we have a complete path */
-+ if (stat(filename, &st) < 0 || !S_ISREG(st.st_mode)
-+ || (fp = fopen_for_read(filename)) == 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, uts.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);
-+ }
-+ }
-+ } else
-+ m_filename = xstrdup(filename);
-+
-+ rc = bb_init_module(m_filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0));
- if (rc)
-- bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
-+ bb_error_msg("can't insert '%s': %s", m_filename, moderror(rc));
-
- return rc;
- }
-diff -Naur busybox-1.22.1/networking/Config.src busybox-1.22.1/networking/Config.src
---- busybox-1.22.1/networking/Config.src 2011-09-06 04:35:17.000000000 +0200
-+++ busybox-1.22.1/networking/Config.src 2011-11-14 14:39:06.000000000 +0100
-@@ -446,6 +446,20 @@
- Otherwise, if udhcpc applet is enabled, it is used.
- Otherwise, ifup/ifdown will have no support for DHCP.
-
-+config FEATURE_IFUPDOWN_CNXT_NORUNPARTS
-+ bool "Cnxt dissable run-parts"
-+ default n
-+ depends on IFUPDOWN
-+ help
-+ CNXT: This stops ifup/down executing runparts
-+
-+config FEATURE_IFUPDOWN_CNXT_UDHCPCLOC
-+ bool "Cnxt location for udhcpc"
-+ default n
-+ depends on IFUPDOWN
-+ help
-+ This searched for udhcpc script in /etc/network
-+
- config INETD
- bool "inetd"
- default y
-diff -Naur busybox-1.22.1/networking/ifupdown.c busybox-1.22.1/networking/ifupdown.c
---- busybox-1.22.1/networking/ifupdown.c 2011-09-06 04:35:17.000000000 +0200
-+++ busybox-1.22.1/networking/ifupdown.c 2011-11-14 14:39:06.000000000 +0100
-@@ -534,8 +534,13 @@
- "pump -i %iface% -k",
- },
- { "udhcpc",
-+#ifdef CONFIG_FEATURE_IFUPDOWN_CNXT_UDHCPCLOC
-+ "udhcpc -n -p /var/run/udhcpc.%iface%.pid -t 5 -s /etc/network/udhcpc.sh "
-+ "-i %iface% [[-H %hostname%]] [[-c %clientid%]]",
-+#else
- "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %client%]]"
- "[[ -s %script%]][[ %udhcpc_opts%]]",
-+#endif
- "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
- },
- };
-@@ -1030,7 +1035,9 @@
- static int execute_all(struct interface_defn_t *ifd, const char *opt)
- {
- int i;
-+#ifndef CONFIG_FEATURE_IFUPDOWN_CNXT_NORUNPARTS
- char *buf;
-+#endif
- for (i = 0; i < ifd->n_options; i++) {
- if (strcmp(ifd->option[i].name, opt) == 0) {
- if (!doit(ifd->option[i].value)) {
-@@ -1039,9 +1046,13 @@
- }
- }
-
-+#ifndef CONFIG_FEATURE_IFUPDOWN_CNXT_NORUNPARTS
- buf = xasprintf("run-parts /etc/network/if-%s.d", opt);
- /* heh, we don't bother free'ing it */
- return doit(buf);
-+#else
-+ return 1;
-+#endif
- }
-
- static int check(char *str)
# Debugging Options
#
# CONFIG_DEBUG is not set
+# CONFIG_UNIT_TEST is not set
# CONFIG_DEBUG_PESSIMIZE is not set
# CONFIG_WERROR is not set
CONFIG_NO_DEBUG_LIB=y
CONFIG_GZIP=y
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
CONFIG_GZIP_FAST=0
+CONFIG_FEATURE_GZIP_LEVELS=n
# CONFIG_LZOP is not set
# CONFIG_LZOP_COMPR_HIGH is not set
# CONFIG_RPM2CPIO is not set
# CONFIG_HOSTID is not set
# CONFIG_ID is not set
CONFIG_GROUPS=y
+CONFIG_SHUF=n
CONFIG_TEST=y
# CONFIG_FEATURE_TEST_64 is not set
CONFIG_TOUCH=y
CONFIG_TR=y
CONFIG_FEATURE_TR_CLASSES=y
CONFIG_FEATURE_TR_EQUIV=y
+CONFIG_TRUNCATE=y
+CONFIG_UNLINK=n
CONFIG_BASE64=y
# CONFIG_WHO is not set
# CONFIG_USERS is not set
CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
CONFIG_FEATURE_DD_IBS_OBS=y
+CONFIG_FEATURE_DD_STATUS=y
CONFIG_DF=y
# CONFIG_FEATURE_DF_FANCY is not set
CONFIG_DIRNAME=y
CONFIG_STTY=y
# CONFIG_SUM is not set
CONFIG_SYNC=y
+CONFIG_FEATURE_SYNC_FANCY=n
# CONFIG_TAC is not set
CONFIG_TAIL=y
CONFIG_FEATURE_FANCY_TAIL=y
CONFIG_TRUE=y
# CONFIG_TTY is not set
CONFIG_UNAME=y
+CONFIG_UNAME_OSNAME="GNU/Linux"
CONFIG_UNEXPAND=y
CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y
CONFIG_UNIQ=y
# CONFIG_WHOAMI is not set
CONFIG_YES=y
+#
+# Common options
+#
+CONFIG_FEATURE_VERBOSE=y
#
# Common options for cp and mv
#
CONFIG_FEATURE_VI_SET=y
CONFIG_FEATURE_VI_WIN_RESIZE=y
CONFIG_FEATURE_VI_ASK_TERMINAL=y
+CONFIG_FEATURE_VI_UNDO=y
+CONFIG_FEATURE_VI_UNDO_QUEUE=y
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
CONFIG_FEATURE_ALLOW_EXEC=y
#
CONFIG_FEATURE_FIND_NEWER=y
CONFIG_FEATURE_FIND_INUM=y
CONFIG_FEATURE_FIND_EXEC=y
+CONFIG_FEATURE_FIND_EXEC_PLUS=y
CONFIG_FEATURE_FIND_USER=y
CONFIG_FEATURE_FIND_GROUP=y
CONFIG_FEATURE_FIND_NOT=y
# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
+CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
#
# Init Utilities
CONFIG_ADDUSER=y
# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
# CONFIG_FEATURE_CHECK_NAMES is not set
+CONFIG_LAST_ID=60000
CONFIG_FIRST_SYSTEM_ID=0
CONFIG_LAST_SYSTEM_ID=0
# CONFIG_ADDGROUP is not set
CONFIG_LOGIN=y
# CONFIG_LOGIN_SESSION_AS_CHILD is not set
# CONFIG_PAM is not set
+CONFIG_FEATURE_USE_SENDFILE=n
# CONFIG_LOGIN_SCRIPTS is not set
CONFIG_FEATURE_NOLOGIN=y
CONFIG_FEATURE_SECURETTY=y
# Linux System Utilities
#
CONFIG_BLOCKDEV=y
+CONFIG_FATATTR=n
CONFIG_FSTRIM=y
CONFIG_MDEV=y
CONFIG_FEATURE_MDEV_CONF=y
CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
CONFIG_FEATURE_MDEV_EXEC=y
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
-# CONFIG_REV is not set
+CONFIG_REV=n
+CONFIG_UEVENT=y
# CONFIG_ACPID is not set
# CONFIG_FEATURE_ACPID_COMPAT is not set
# CONFIG_BLKID is not set
CONFIG_FEATURE_MOUNT_CIFS=y
CONFIG_FEATURE_MOUNT_FLAGS=y
CONFIG_FEATURE_MOUNT_FSTAB=y
+CONFIG_FEATURE_MOUNT_OTHERTAB=y
CONFIG_PIVOT_ROOT=y
CONFIG_RDATE=y
# CONFIG_RDEV is not set
# CONFIG_SCRIPTREPLAY is not set
# CONFIG_SETARCH is not set
CONFIG_SWAPONOFF=y
+CONFIG_FEATURE_SWAPON_DISCARD=y
# CONFIG_FEATURE_SWAPON_PRI is not set
# CONFIG_SWITCH_ROOT is not set
CONFIG_UMOUNT=y
# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
CONFIG_FEATURE_CROND_DIR="/etc/cron"
CONFIG_CRONTAB=y
+CONFIG_I2CGET=n
+CONFIG_I2CSET=n
+CONFIG_I2CDUMP=n
+CONFIG_I2CDETECT=n
# CONFIG_DC is not set
# CONFIG_FEATURE_DC_LIBM is not set
# CONFIG_DEVFSD is not set
CONFIG_HOSTNAME=y
# CONFIG_HTTPD is not set
# CONFIG_FEATURE_HTTPD_RANGES is not set
-# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
# CONFIG_FEATURE_HTTPD_SETUID is not set
# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
CONFIG_FEATURE_IFCONFIG_HW=y
# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
# CONFIG_IFENSLAVE is not set
-CONFIG_IFPLUGD=y
+CONFIG_IFPLUGD=n
CONFIG_IFUPDOWN=y
CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
CONFIG_FEATURE_IFUPDOWN_IP=y
# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
-CONFIG_FEATURE_IFUPDOWN_CNXT_NORUNPARTS=y
-CONFIG_FEATURE_IFUPDOWN_CNXT_UDHCPCLOC=y
CONFIG_INETD=y
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
# CONFIG_FEATURE_IP_RULE is not set
# CONFIG_FEATURE_IP_SHORT_FORMS is not set
# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
-# CONFIG_IPADDR is not set
-# CONFIG_IPLINK is not set
-# CONFIG_IPROUTE is not set
+CONFIG_IPADDR=y
+CONFIG_IPLINK=y
+CONFIG_IPROUTE=y
+CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
# CONFIG_IPTUNNEL is not set
# CONFIG_IPRULE is not set
# CONFIG_IPCALC is not set
CONFIG_DHCPD_LEASES_FILE=""
CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
+CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
# CONFIG_FEATURE_UDHCP_PORT is not set
CONFIG_UDHCP_DEBUG=0
# CONFIG_FEATURE_UDHCP_RFC3397 is not set
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_LONG_OPTIONS=y
CONFIG_FEATURE_WGET_TIMEOUT=y
+CONFIG_FEATURE_WGET_OPENSSL=y
+CONFIG_FEATURE_WGET_SSL_HELPER=y
# CONFIG_ZCIP is not set
#
CONFIG_ASH_BUILTIN_ECHO=y
CONFIG_ASH_BUILTIN_PRINTF=y
CONFIG_ASH_BUILTIN_TEST=y
+CONFIG_ASH_HELP=n
# CONFIG_ASH_CMDCMD is not set
CONFIG_ASH_MAIL=y
CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
+++ /dev/null
---- busybox-1.22.1/shell/ash.c
-+++ busybox-1.22.1-ash/shell/ash.c
-@@ -13014,7 +13014,7 @@ init(void)
- setvar2("PPID", utoa(getppid()));
- #if ENABLE_ASH_BASH_COMPAT
- p = lookupvar("SHLVL");
-- setvar2("SHLVL", utoa(p ? atoi(p) + 1 : 1));
-+ setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT);
- #endif
- p = lookupvar("PWD");
- if (p) {
---- busybox-1.22.1/libbb/time.c
-+++ busybox-1.22.1-date/libbb/time.c
-@@ -68,15 +68,23 @@ void FAST_FUNC parse_datestr(const char
- /* else end != NUL and we error out */
- }
- } else
-- /* yyyy-mm-dd HH */
-- if (sscanf(date_str, "%u-%u-%u %u%c", &ptm->tm_year,
-+ if (strchr(date_str, '-')
-+ /* Why strchr('-') check?
-+ * sscanf below will trash ptm->tm_year, this breaks
-+ * if parse_str is "10101010" (iow, "MMddhhmm" form)
-+ * because we destroy year. Do these sscanf
-+ * only if we saw a dash in parse_str.
-+ */
-+ /* yyyy-mm-dd HH */
-+ && (sscanf(date_str, "%u-%u-%u %u%c", &ptm->tm_year,
- &ptm->tm_mon, &ptm->tm_mday,
- &ptm->tm_hour,
- &end) >= 4
-- /* yyyy-mm-dd */
-- || sscanf(date_str, "%u-%u-%u%c", &ptm->tm_year,
-+ /* yyyy-mm-dd */
-+ || sscanf(date_str, "%u-%u-%u%c", &ptm->tm_year,
- &ptm->tm_mon, &ptm->tm_mday,
- &end) >= 3
-+ )
- ) {
- ptm->tm_year -= 1900; /* Adjust years */
- ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */
---- busybox-1.22.1/networking/libiproute/iplink.c
-+++ busybox-1.22.1-iplink/networking/libiproute/iplink.c
-@@ -31,6 +31,16 @@
- #ifndef IFLA_LINKINFO
- # define IFLA_LINKINFO 18
- # define IFLA_INFO_KIND 1
-+# define IFLA_INFO_DATA 2
-+#endif
-+
-+#ifndef IFLA_VLAN_MAX
-+# define IFLA_VLAN_ID 1
-+# define IFLA_VLAN_FLAGS 2
-+struct ifla_vlan_flags {
-+ uint32_t flags;
-+ uint32_t mask;
-+};
- #endif
-
- /* taken from linux/sockios.h */
---- busybox-1.22.1/networking/nc_bloaty.c
-+++ busybox-1.22.1-nc/networking/nc_bloaty.c
-@@ -175,9 +175,9 @@ enum {
- OPT_w = (1 << 5),
- OPT_l = (1 << 6) * ENABLE_NC_SERVER,
- OPT_k = (1 << 7) * ENABLE_NC_SERVER,
-- OPT_i = (1 << (7+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
-- OPT_o = (1 << (8+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
-- OPT_z = (1 << (9+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
-+ OPT_i = (1 << (6+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
-+ OPT_o = (1 << (7+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
-+ OPT_z = (1 << (8+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
- };
-
- #define o_nflag (option_mask32 & OPT_n)
---- a/archival/libarchive/liblzo.h
-+++ b/archival/libarchive/liblzo.h
-@@ -76,11 +76,13 @@
- # define TEST_IP (ip < ip_end)
- # define NEED_IP(x) \
- if ((unsigned)(ip_end - ip) < (unsigned)(x)) goto input_overrun
-+# define TEST_IV(x) if ((x) > (unsigned)0 - (511)) goto input_overrun
-
- # undef TEST_OP /* don't need both of the tests here */
- # define TEST_OP 1
- # define NEED_OP(x) \
- if ((unsigned)(op_end - op) < (unsigned)(x)) goto output_overrun
-+# define TEST_OV(x) if ((x) > (unsigned)0 - (511)) goto output_overrun
-
- #define HAVE_ANY_OP 1
-
---- a/archival/libarchive/lzo1x_d.c
-+++ b/archival/libarchive/lzo1x_d.c
-@@ -92,6 +92,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
- ip++;
- NEED_IP(1);
- }
-+ TEST_IV(t);
- t += 15 + *ip++;
- }
- /* copy literals */
-@@ -224,6 +225,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
- ip++;
- NEED_IP(1);
- }
-+ TEST_IV(t);
- t += 31 + *ip++;
- }
- #if defined(COPY_DICT)
-@@ -265,6 +267,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
- ip++;
- NEED_IP(1);
- }
-+ TEST_IV(t);
- t += 7 + *ip++;
- }
- #if defined(COPY_DICT)
---- a/archival/libarchive/open_transformer.c
-+++ b/archival/libarchive/open_transformer.c
-@@ -182,27 +182,26 @@ int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_detected)
-
- int FAST_FUNC open_zipped(const char *fname)
- {
-- char *sfx;
- int fd;
-
- fd = open(fname, O_RDONLY);
- if (fd < 0)
- return fd;
-
-- sfx = strrchr(fname, '.');
-- if (sfx) {
-- sfx++;
-- if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
-- /* .lzma has no header/signature, just trust it */
-+ if (ENABLE_FEATURE_SEAMLESS_LZMA) {
-+ /* .lzma has no header/signature, can only detect it by extension */
-+ char *sfx = strrchr(fname, '.');
-+ if (sfx && strcmp(sfx+1, "lzma") == 0) {
- open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma");
-- else
-- if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
-- || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
-- || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
-- ) {
-- setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
-+ return fd;
- }
- }
-+ if ((ENABLE_FEATURE_SEAMLESS_GZ)
-+ || (ENABLE_FEATURE_SEAMLESS_BZ2)
-+ || (ENABLE_FEATURE_SEAMLESS_XZ)
-+ ) {
-+ setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
-+ }
-
- return fd;
- }
-
+++ /dev/null
-diff -Naur busybox-1.18.1/console-tools/setconsole.c busybox-1.18.1/console-tools/setconsole.c
---- busybox-1.18.1/console-tools/setconsole.c 2010-12-20 01:41:27.000000000 +0100
-+++ busybox-1.18.1/console-tools/setconsole.c 2011-01-09 01:43:26.000000000 +0100
-@@ -34,7 +34,7 @@
- device = DEV_CONSOLE;
- }
-
-- xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);
-+ xioctl(xopen(device, O_WRONLY), TIOCCONS, NULL);
- return EXIT_SUCCESS;
- }
-
-diff -Naur busybox-1.18.1/init/init.c busybox-1.18.1/init/init.c
---- busybox-1.18.1/init/init.c 2010-12-20 01:41:27.000000000 +0100
-+++ busybox-1.18.1/init/init.c 2011-01-09 01:43:26.000000000 +0100
-@@ -264,6 +264,11 @@
- }
- }
-
-+#ifdef VT_OPENQRY
-+/* don't want that "vt102" stuff... */
-+#undef VT_OPENQRY
-+#endif
-+
- static void console_init(void)
- {
- #ifdef VT_OPENQRY
-@@ -271,16 +276,23 @@
- #endif
- char *s;
-
-+# if 0
- s = getenv("CONSOLE");
- if (!s)
- s = getenv("console");
-+#endif
-+ s = "/dev/console";
-+ mknod(s, (S_IFCHR | 0600), 0x0501);
-+
- if (s) {
-+ close(STDIN_FILENO);
-+ /* we'll get STDIN_FILENO from open... */
- int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY);
- if (fd >= 0) {
-- dup2(fd, STDIN_FILENO);
- dup2(fd, STDOUT_FILENO);
-- xmove_fd(fd, STDERR_FILENO);
-+ dup2(fd, STDERR_FILENO);
- }
-+ ndelay_off(STDIN_FILENO);
- dbg_message(L_LOG, "console='%s'", s);
- } else {
- /* Make sure fd 0,1,2 are not closed
-@@ -297,8 +309,8 @@
- /* Not a linux terminal, probably serial console.
- * Force the TERM setting to vt102
- * if TERM is set to linux (the default) */
-- if (!s || strcmp(s, "linux") == 0)
-- putenv((char*)"TERM=vt102");
-+/* if (!s || strcmp(s, "linux") == 0)
-+ putenv((char*)"TERM=vt102"); */
- if (!ENABLE_FEATURE_INIT_SYSLOG)
- log_console = NULL;
- } else
-diff -Naur busybox-1.18.1/modutils/Config.src busybox-1.18.1/modutils/Config.src
---- busybox-1.18.1/modutils/Config.src 2010-12-20 01:41:27.000000000 +0100
-+++ busybox-1.18.1/modutils/Config.src 2011-01-09 01:43:26.000000000 +0100
-@@ -229,7 +229,7 @@
- config DEFAULT_MODULES_DIR
- string "Default directory containing modules"
- default "/lib/modules"
-- depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO
-+ depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO || INSMOD
- help
- Directory that contains kernel modules.
- Defaults to "/lib/modules"
-diff -Naur busybox-1.18.1/modutils/insmod.c busybox-1.18.1/modutils/insmod.c
---- busybox-1.18.1/modutils/insmod.c 2010-12-20 01:41:27.000000000 +0100
-+++ busybox-1.18.1/modutils/insmod.c 2011-01-09 01:43:26.000000000 +0100
-@@ -36,11 +36,42 @@
- //usage: )
- //usage:#endif
-
-+#include <sys/utsname.h>
-+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;
-+}
-+
- int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int insmod_main(int argc UNUSED_PARAM, char **argv)
- {
- char *filename;
- int rc;
-+int len;
-+char *tmp;
-+char *tmp2;
-+int k_version = 0;
-+struct stat st;
-+struct utsname uts;
-+char *m_name;
-+FILE *fp;
-
- /* Compat note:
- * 2.6 style insmod has no options and required filename
-@@ -59,9 +90,99 @@
- if (!filename)
- bb_show_usage();
-
-- rc = bb_init_module(filename, parse_cmdline_module_options(argv));
-+ /* Grab the module name */
-+ tmp = xstrdup(filename);
-+ len = strlen(filename);
-+
-+ if (uname(&uts) == 0) {
-+ if (uts.release[0] == '2') {
-+ k_version = uts.release[2] - '0';
-+ }
-+ }
-+
-+ if (k_version > 4 && len > 3 && tmp[len - 3] == '.'
-+ && tmp[len - 2] == 'k' && tmp[len - 1] == 'o'
-+ ) {
-+ len -= 3;
-+ tmp[len] = '\0';
-+ } else
-+ if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') {
-+ len -= 2;
-+ tmp[len] = '\0';
-+ }
-+
-+ if (k_version > 4)
-+ m_fullName = xasprintf("%s.ko", tmp);
-+ else
-+ m_fullName = xasprintf("%s.o", tmp);
-+
-+ if (!m_name) {
-+ m_name = tmp;
-+ }
-+ free(tmp);
-+
-+ /* first look in /var/lib/modules */
-+ tmp2 = alloca(strlen(m_fullName) + sizeof("/var/lib/modules/"));
-+ strcpy(tmp2, "/var/lib/modules/");
-+ strcat(tmp2, m_fullName);
-+ if (stat(tmp2, &st) >= 0 && S_ISREG(st.st_mode) && (fp = fopen(tmp2, "r")) != NULL) {
-+ m_filename = xstrdup(tmp2);
-+ printf("insmod: preferring module %s\n", m_filename);
-+ } else
-+ /* Get a filedesc for the module. Check that we have a complete path */
-+ if (stat(filename, &st) < 0 || !S_ISREG(st.st_mode)
-+ || (fp = fopen_for_read(filename)) == 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, uts.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);
-+ }
-+ }
-+ } else
-+ m_filename = xstrdup(filename);
-+
-+ rc = bb_init_module(m_filename, parse_cmdline_module_options(argv));
- if (rc)
-- bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
-+ bb_error_msg("can't insert '%s': %s", m_filename, moderror(rc));
-
- return rc;
- }
-diff -Naur busybox-1.18.1/networking/Config.src busybox-1.18.1/networking/Config.src
---- busybox-1.18.1/networking/Config.src 2010-12-21 05:29:45.000000000 +0100
-+++ busybox-1.18.1/networking/Config.src 2011-01-09 01:43:26.000000000 +0100
-@@ -445,6 +445,20 @@
- Otherwise, if udhcpc applet is enabled, it is used.
- Otherwise, ifup/ifdown will have no support for DHCP.
-
-+config FEATURE_IFUPDOWN_CNXT_NORUNPARTS
-+ bool "Cnxt dissable run-parts"
-+ default n
-+ depends on IFUPDOWN
-+ help
-+ CNXT: This stops ifup/down executing runparts
-+
-+config FEATURE_IFUPDOWN_CNXT_UDHCPCLOC
-+ bool "Cnxt location for udhcpc"
-+ default n
-+ depends on IFUPDOWN
-+ help
-+ This searched for udhcpc script in /etc/network
-+
- config INETD
- bool "inetd"
- default y
-diff -Naur busybox-1.18.1/networking/ifupdown.c busybox-1.18.1/networking/ifupdown.c
---- busybox-1.18.1/networking/ifupdown.c 2010-12-20 01:41:27.000000000 +0100
-+++ busybox-1.18.1/networking/ifupdown.c 2011-01-09 01:52:02.000000000 +0100
-@@ -507,8 +507,13 @@
- "pump -i %iface% -k",
- },
- { "udhcpc",
-+#ifdef CONFIG_FEATURE_IFUPDOWN_CNXT_UDHCPCLOC
-+ "udhcpc -n -p /var/run/udhcpc.%iface%.pid -t 5 -s /etc/network/udhcpc.sh "
-+ "-i %iface% [[-H %hostname%]] [[-c %clientid%]]",
-+#else
- "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %client%]]"
- "[[ -s %script%]][[ %udhcpc_opts%]]",
-+#endif
- "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
- },
- };
-@@ -1004,7 +1009,9 @@
- static int execute_all(struct interface_defn_t *ifd, const char *opt)
- {
- int i;
-+#ifndef CONFIG_FEATURE_IFUPDOWN_CNXT_NORUNPARTS
- char *buf;
-+#endif
- for (i = 0; i < ifd->n_options; i++) {
- if (strcmp(ifd->option[i].name, opt) == 0) {
- if (!doit(ifd->option[i].value)) {
-@@ -1013,9 +1020,13 @@
- }
- }
-
-+#ifndef CONFIG_FEATURE_IFUPDOWN_CNXT_NORUNPARTS
- buf = xasprintf("run-parts /etc/network/if-%s.d", opt);
- /* heh, we don't bother free'ing it */
- return doit(buf);
-+#else
-+ return 1;
-+#endif
- }
-
- static int check(char *str)
$(REMOVE)/procps-3.2.8
touch $@
-$(D)/busybox: $(ARCHIVE)/busybox-1.22.1.tar.bz2 | $(TARGETPREFIX)
- $(UNTAR)/busybox-1.22.1.tar.bz2
- pushd $(BUILD_TMP)/busybox-1.22.1 && \
- $(PATCH)/busybox-1.22.1-last-fixes.diff && \
- $(PATCH)/busybox-1.22.1-coolstream.diff && \
+$(D)/busybox: $(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2 | $(TARGETPREFIX)
+ $(UNTAR)/busybox-$(BUSYBOX_VER).tar.bz2
+ pushd $(BUILD_TMP)/busybox-$(BUSYBOX_VER) && \
+ if [ "$(BUSYBOX_VER)" = "1.24.1" ]; then \
+ $(PATCH)/bb_fixes-1.24.1/busybox-1.24.1-unzip.patch; \
+ $(PATCH)/bb_fixes-1.24.1/busybox-1.24.1-unzip-regression.patch; \
+ $(PATCH)/bb_fixes-1.24.1/busybox-1.24.1-truncate-open-mode.patch; \
+ fi; \
+ $(PATCH)/busybox-1.18-hack-init-s-console.patch; \
+ $(PATCH)/busybox-1.20-ifupdown.c.diff; \
+ $(PATCH)/busybox-1.21.1-changing-the-order-sys-tree-is-scanned-with-mdev.diff; \
+ $(PATCH)/busybox-1.21.1-mdev.diff; \
+ $(PATCH)/busybox-1.22.1-coolstream.diff; \
+ $(PATCH)/busybox-1.24.1-wget.diff; \
cp $(PATCHES)/busybox-1.22.1-hd1.config .config && \
sed -i -e 's#^CONFIG_PREFIX.*#CONFIG_PREFIX="$(TARGETPREFIX)"#' .config && \
$(MAKE) all CROSS_COMPILE=$(TARGET)- CFLAGS_EXTRA="$(TARGET_CFLAGS)" && \
$(MAKE) install CROSS_COMPILE=$(TARGET)- CFLAGS_EXTRA="$(TARGET_CFLAGS)"
- $(REMOVE)/busybox-1.22.1
+ $(REMOVE)/busybox-$(BUSYBOX_VER)
touch $@
$(D)/e2fsprogs: $(ARCHIVE)/e2fsprogs-$(E2FSPROGS_VER).tar.gz | $(TARGETPREFIX)
$(ARCHIVE)/procps-3.2.8.tar.gz:
$(WGET) http://www.fhloston-paradise.de/procps-3.2.8.tar.gz
-$(ARCHIVE)/busybox-1.22.1.tar.bz2:
- $(WGET) http://www.fhloston-paradise.de/busybox-1.22.1.tar.bz2
+$(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2:
+ $(WGET) https://busybox.net/downloads/busybox-$(BUSYBOX_VER).tar.bz2
$(ARCHIVE)/samba-$(SAMBA2_VER).tar.gz:
$(WGET) http://samba.org/samba/ftp/old-versions/samba-$(SAMBA2_VER).tar.gz
+BUSYBOX_VER = 1.24.1
+
# crosstool-ng versions
#CT_VER_NEVIS = 1.20.0_20150218-2311_git-master_41722f5
CT_VER_NEVIS = 1.20.0