Updated get_hostname function

Ensure that the returned string doesn't end with a '\n' character
master
Ronald1985 2 years ago
parent b67c817fa3
commit 7d7e75ee82

@ -56,7 +56,10 @@ __read_entire_file_from_handle :: proc(fd: os.Handle, allocator := context.alloc
get_hostname :: proc() -> (string, bool) { get_hostname :: proc() -> (string, bool) {
data, ok := __read_entire_file_from_filename("/proc/sys/kernel/hostname") data, ok := __read_entire_file_from_filename("/proc/sys/kernel/hostname")
return string(data), ok hostname: string
hostname, ok = strings.remove_all(string(data), "\n")
return hostname, ok
} }
get_key :: proc(s: string) -> (string, bool) { get_key :: proc(s: string) -> (string, bool) {

Loading…
Cancel
Save