summaryrefslogtreecommitdiff
path: root/package/busybox/busybox-1.10.1-echo.patch
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2008-05-05 17:17:00 +0000
committerPeter Korsgaard <jacmet@sunsite.dk>2008-05-05 17:17:00 +0000
commit371c487a0d1a2d936311f0392859585ecfc58d6a (patch)
treec0145806643037da3d2687f4f1531405f51e93ca /package/busybox/busybox-1.10.1-echo.patch
parent1a596bfe2f3c2b4e081ffb365a5ef8a93ef4e841 (diff)
busybox: additional 1.10.1 patches
Diffstat (limited to 'package/busybox/busybox-1.10.1-echo.patch')
-rw-r--r--package/busybox/busybox-1.10.1-echo.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/package/busybox/busybox-1.10.1-echo.patch b/package/busybox/busybox-1.10.1-echo.patch
new file mode 100644
index 000000000..c635aa20e
--- /dev/null
+++ b/package/busybox/busybox-1.10.1-echo.patch
@@ -0,0 +1,38 @@
+--- busybox-1.10.1/coreutils/echo.c Sat Apr 19 05:50:32 2008
++++ busybox-1.10.1-echo/coreutils/echo.c Wed Apr 30 02:37:08 2008
+@@ -27,10 +27,8 @@
+
+ /* This is a NOFORK applet. Be very careful! */
+
+-/* argc is unused, but removing it precludes compiler from
+- * using call -> jump optimization */
++/* NB: can be used by shell even if not enabled as applet */
+
+-int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int echo_main(int argc ATTRIBUTE_UNUSED, char **argv)
+ {
+ const char *arg;
+@@ -110,15 +108,19 @@
+ }
+ #if !ENABLE_FEATURE_FANCY_ECHO
+ /* SUSv3 specifies that octal escapes must begin with '0'. */
+- if ( (((unsigned char)*arg) - '1') >= 7)
++ if ( ((int)(unsigned char)(*arg) - '0') >= 8) /* '8' or bigger */
+ #endif
+ {
+ /* Since SUSv3 mandates a first digit of 0, 4-digit octals
+ * of the form \0### are accepted. */
+- if (*arg == '0' && ((unsigned char)(arg[1]) - '0') < 8) {
+- arg++;
++ if (*arg == '0') {
++ /* NB: don't turn "...\0" into "...\" */
++ if (arg[1] && ((unsigned char)(arg[1]) - '0') < 8) {
++ arg++;
++ }
+ }
+- /* bb_process_escape_sequence can handle nul correctly */
++ /* bb_process_escape_sequence handles NUL correctly
++ * ("...\" case). */
+ c = bb_process_escape_sequence(&arg);
+ }
+ }