libs/core: Replace luci.sys.bigendian with a system independent version
[project/luci.git] / libs / core / luasrc / sys.lua
index 217a36b0f4a1ef6db8767701982cc2708fb9fe3f..8e8aab731515cd8b342c19f4b3e40772f8e9a6e0 100644 (file)
@@ -31,14 +31,10 @@ require("luci.bits")
 require("luci.util")
 require("luci.fs")
 
---- Test wheather the current system is operating in big endian mode.
--- @return     Boolean value indicating wheather system is big endian
+--- Test whether the current system is operating in big endian mode.
+-- @return     Boolean value indicating whether system is big endian
 function bigendian()
-       local fp = io.open("/bin/sh")
-       fp:seek("set", 5)
-       local be = (fp:read(1):byte() ~= 1)
-       fp:close()
-       return be
+       return string.byte(string.dump(function() end), 7) == 0
 end
 
 --- Execute given commandline and gather stdout.