summaryrefslogtreecommitdiff
path: root/packages/busybox/busybox-1.00/unzip-endian-fixes.patch
diff options
context:
space:
mode:
authorErik Hovland <erik@hovland.org>2006-09-01 18:26:01 +0000
committerErik Hovland <erik@hovland.org>2006-09-01 18:26:01 +0000
commitdbfe597f0d9b9c8837dc6a28c0adfea4b281d46c (patch)
treecfb3618af70776ef20f1f3a4e5df4ee646608385 /packages/busybox/busybox-1.00/unzip-endian-fixes.patch
parentf42a4c6fe7b0250c33335171c8534e9a3174d3da (diff)
busybox 1.00: Incorporate fixes from familiar 0.8.4 release
* Add --oknodo argument to start-stop-daemon * df fixes * unzip and libuncompress fixes backported from 1.1.0 * bump rev to r37 since familiar 0.8.4 shipped with r36
Diffstat (limited to 'packages/busybox/busybox-1.00/unzip-endian-fixes.patch')
-rw-r--r--packages/busybox/busybox-1.00/unzip-endian-fixes.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/packages/busybox/busybox-1.00/unzip-endian-fixes.patch b/packages/busybox/busybox-1.00/unzip-endian-fixes.patch
new file mode 100644
index 0000000000..56af433c30
--- /dev/null
+++ b/packages/busybox/busybox-1.00/unzip-endian-fixes.patch
@@ -0,0 +1,54 @@
+--- archival/unzip.c.orig 2005-03-17 18:42:45.000000000 -0500
++++ archival/unzip.c 2005-03-17 17:46:45.000000000 -0500
+@@ -46,10 +46,28 @@
+ #include "unarchive.h"
+ #include "busybox.h"
+
+-#define ZIP_FILEHEADER_MAGIC 0x04034b50
+-#define ZIP_CDS_MAGIC 0x02014b50
+-#define ZIP_CDS_END_MAGIC 0x06054b50
+-#define ZIP_DD_MAGIC 0x08074b50
++#if (BYTE_ORDER == BIG_ENDIAN)
++static inline unsigned short
++__swap16(unsigned short x) {
++ return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
++}
++
++static inline uint32_t
++__swap32(uint32_t x) {
++ return (((x & 0xFF) << 24) |
++ ((x & 0xFF00) << 8) |
++ ((x & 0xFF0000) >> 8) |
++ ((x & 0xFF000000) >> 24));
++}
++#else
++#define __swap16(x) (x)
++#define __swap32(x) (x)
++#endif
++
++#define ZIP_FILEHEADER_MAGIC __swap32(0x04034b50)
++#define ZIP_CDS_MAGIC __swap32(0x02014b50)
++#define ZIP_CDS_END_MAGIC __swap32(0x06054b50)
++#define ZIP_DD_MAGIC __swap32(0x08074b50)
+
+ extern unsigned int gunzip_crc;
+ extern unsigned int gunzip_bytes_out;
+@@ -249,6 +267,18 @@
+
+ /* Read the file header */
+ unzip_read(src_fd, zip_header.raw, 26);
++#if (BYTE_ORDER == BIG_ENDIAN)
++ zip_header.formated.version = __swap16(zip_header.formated.version);
++ zip_header.formated.flags = __swap16(zip_header.formated.flags);
++ zip_header.formated.method = __swap16(zip_header.formated.method);
++ zip_header.formated.modtime = __swap16(zip_header.formated.modtime);
++ zip_header.formated.moddate = __swap16(zip_header.formated.moddate);
++ zip_header.formated.crc32 = __swap32(zip_header.formated.crc32);
++ zip_header.formated.cmpsize = __swap32(zip_header.formated.cmpsize);
++ zip_header.formated.ucmpsize = __swap32(zip_header.formated.ucmpsize);
++ zip_header.formated.filename_len = __swap16(zip_header.formated.filename_len);
++ zip_header.formated.extra_len = __swap16(zip_header.formated.extra_len);
++#endif
+ if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) {
+ bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method);
+ }