diff --git a/vlib/os/os_nix.c.v b/vlib/os/os_nix.c.v index 339f4f6b244fe8..08d5833d658f97 100644 --- a/vlib/os/os_nix.c.v +++ b/vlib/os/os_nix.c.v @@ -61,9 +61,9 @@ pub const s_iwoth = 0o0002 // Write by others pub const s_ixoth = 0o0001 -fn C.utime(&char, voidptr) int +fn C.utime(&char, &C.utimbuf) int -fn C.uname(name voidptr) int +fn C.uname(name &C.utsname) int fn C.symlink(&char, &char) int @@ -215,7 +215,7 @@ fn native_glob_pattern(pattern string, mut matches []string) ! { pub fn utime(path string, actime int, modtime int) ! { u := C.utimbuf{actime, modtime} - if C.utime(&char(path.str), voidptr(&u)) != 0 { + if C.utime(&char(path.str), &u) != 0 { return error_with_code(posix_get_error_msg(C.errno), C.errno) } } @@ -238,10 +238,8 @@ pub fn utime(path string, actime int, modtime int) ! { // See also https://pubs.opengroup.org/onlinepubs/7908799/xsh/sysutsname.h.html pub fn uname() Uname { mut u := Uname{} - utsize := sizeof(C.utsname) unsafe { - x := malloc_noscan(int(utsize)) - d := &C.utsname(x) + d := &C.utsname(malloc_noscan(int(sizeof(C.utsname)))) if C.uname(d) == 0 { u.sysname = cstring_to_vstring(d.sysname) u.nodename = cstring_to_vstring(d.nodename)