net.unix: use byte() instead of u16() cast for addr.sun_family

pull/13511/head
Delyan Angelov 2022-02-18 13:47:12 +02:00
parent fad254dcce
commit d86b18844e
1 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ fn (mut s StreamSocket) connect(a string) ? {
}
mut addr := C.sockaddr_un{}
unsafe { C.memset(&addr, 0, sizeof(C.sockaddr_un)) }
addr.sun_family = u16(C.AF_UNIX)
addr.sun_family = byte(C.AF_UNIX)
unsafe { C.strncpy(&addr.sun_path[0], &char(a.str), max_sun_path) }
size := C.SUN_LEN(&addr)
res := C.connect(s.handle, voidptr(&addr), size)
@ -94,7 +94,7 @@ pub fn listen_stream(sock string) ?&StreamListener {
s.path = sock
mut addr := C.sockaddr_un{}
unsafe { C.memset(&addr, 0, sizeof(C.sockaddr_un)) }
addr.sun_family = u16(C.AF_UNIX)
addr.sun_family = byte(C.AF_UNIX)
unsafe { C.strncpy(&addr.sun_path[0], &char(sock.str), max_sun_path) }
size := C.SUN_LEN(&addr)
if os.exists(sock) {