Use uname instead of /proc for reading the system hostname
authorSteven Barth <steven@midlink.org>
Thu, 30 Oct 2008 13:13:38 +0000 (13:13 +0000)
committerSteven Barth <steven@midlink.org>
Thu, 30 Oct 2008 13:13:38 +0000 (13:13 +0000)
libs/sys/luasrc/sys.lua

index e8b5e2c3a7e0c9f5e967df3eb14a78e0700a00e9..2edb8f05ae0258511173ba0153f8c671f23c41a8 100644 (file)
@@ -132,7 +132,7 @@ getenv = posix.getenv
 --- Determine the current hostname.
 -- @return             String containing the system hostname
 function hostname()
-       return io.lines("/proc/sys/kernel/hostname")()
+       return posix.uname("%n")
 end
 
 --- Returns the contents of a documented referred by an URL.