[OpenWrt-Devel] [PATCH] [packages] mtd: add missing <endian.h> include

Shiz hi at shiz.me
Thu Jun 4 20:09:27 EDT 2015


trx.c in mtd would not include endian.h, so on systems that do not have
this header implicitly included from the other headers (like musl), both
__BYTE_ORDER and __BIG_ENDIAN would be undefined and thus 0, leading to
it always presuming a big-endian system. this would lead to issues when
running mtd fixtrx on little-endian systems, as it would never recognize
the TRX magic as result of the broken STORE32_LE() macro.

Signed-off-by: Shiz <hi at shiz.me>
Tested-by: Shiz <hi at shiz.me>
---
 package/system/mtd/src/trx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/system/mtd/src/trx.c b/package/system/mtd/src/trx.c
index 089d1ac..245ee76 100644
--- a/package/system/mtd/src/trx.c
+++ b/package/system/mtd/src/trx.c
@@ -26,6 +26,7 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
+#include <endian.h>
 #include <string.h>
 #include <errno.h>
 
-- 
2.4.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list