mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: fix file read (#10247)
This commit is contained in:
@@ -49,7 +49,7 @@ pub fn fd_read(fd int, maxbytes int) (string, int) {
|
||||
return '', 0
|
||||
}
|
||||
unsafe {
|
||||
mut buf := malloc(maxbytes)
|
||||
mut buf := malloc(maxbytes + 1)
|
||||
nbytes := C.read(fd, buf, maxbytes)
|
||||
if nbytes < 0 {
|
||||
free(buf)
|
||||
|
||||
Reference in New Issue
Block a user