From d8cb24eef03ab4b631728f48bbddd4bb245677d4 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 5 Apr 2021 23:42:26 +0300 Subject: [PATCH] ci: fix -cflags -Werror jobs --- vlib/os/os_nix.c.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/os/os_nix.c.v b/vlib/os/os_nix.c.v index 2097301e59..03356e4fae 100644 --- a/vlib/os/os_nix.c.v +++ b/vlib/os/os_nix.c.v @@ -170,15 +170,16 @@ pub fn execute(cmd string) Result { output: 'exec("$cmd") failed' } } - buf := unsafe { &char(malloc(4096)) } + buf := unsafe { malloc(4096) } mut res := strings.new_builder(1024) defer { unsafe { res.free() } } unsafe { bufbp := buf - for C.fgets(bufbp, 4096, f) != 0 { - res.write_ptr(bufbp, vstrlen(bufbp)) + for C.fgets(&char(bufbp), 4096, f) != 0 { + buflen := vstrlen(bufbp) + res.write_ptr(bufbp, buflen) } } soutput := res.str()