Skip to content

Commit be85348

Browse files
committed
(linux) std/os: use bool instead of error to detect errors in hostname implementation
1 parent 19022e6 commit be85348

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

std/os/sys_linux.jule

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ fn hostname()!: (name: str) {
1212
// Try uname first, as it's only one system call and reading
1313
// from /proc is not allowed on Android (future-proof).
1414
let mut un: sys::Utsname
15-
let mut err: any
15+
mut err := false
1616
sys::Uname(&un) else {
17-
err = error
17+
err = true
1818
}
1919

2020
mut buf := make([]byte, 512) // Enough for a DNS name.
@@ -27,7 +27,7 @@ fn hostname()!: (name: str) {
2727
}
2828
// If we got a name and it's not potentially truncated
2929
// (Nodename is 65 bytes), return it.
30-
if err == nil && len(name) > 0 && len(name) < 64 {
30+
if !err && len(name) > 0 && len(name) < 64 {
3131
ret name
3232
}
3333

0 commit comments

Comments
 (0)