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

index e8b5e2c..2edb8f0 100644 (file)
@@ -132,7 +132,7 @@ getenv = posix.getenv
 --- Determine the current hostname.
 -- @return             String containing the system hostname
 function hostname()
 --- 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.
 end
 
 --- Returns the contents of a documented referred by an URL.