summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-06 19:26:35 +0000
committerSteven Barth <steven@midlink.org>2008-08-06 19:26:35 +0000
commit3899482acab141bf8d629de8de55ef3cf8f85926 (patch)
treed556a685d50a1930b70e985c3b2cf4cdd5c1e503
parent206bf7f253b8e136d0d5f375bd9b5c352462c1e6 (diff)
libs/core: Replace luci.sys.bigendian with a system independent version
-rw-r--r--libs/core/luasrc/sys.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/libs/core/luasrc/sys.lua b/libs/core/luasrc/sys.lua
index 217a36b0f..8e8aab731 100644
--- a/libs/core/luasrc/sys.lua
+++ b/libs/core/luasrc/sys.lua
@@ -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.