ref: a22a1c0ae8dcad8e15e21febe9a512231b372cb5
parent: f10af8f76ee02e4b3a72a165e6f8dad05aab22ec
author: Ori Bernstein <[email protected]>
date: Thu Jan 3 10:03:35 EST 2013
Add missing cast in read syscall We were passing an uninitialized length. oops.
--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -391,7 +391,7 @@
const open = {path, opts, mode; -> syscall(Sysopen, cstring(path), opts, mode)}
const close = {fd; -> syscall(Sysclose, fd)}
const creat = {path, mode; -> syscall(Syscreat, cstring(path), mode)}
-const read = {fd, buf; -> syscall(Sysread, fd, buf castto(char*), buf.len) castto(size)}
+const read = {fd, buf; -> syscall(Sysread, fd, buf castto(char*), buf.len castto(size)) castto(size)}
const write = {fd, buf; -> syscall(Syswrite, fd, buf castto(char*), buf.len castto(size)) castto(size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, fd, off, whence)}
const fstat = {fd, sb; -> syscall(Sysfstat, fd, sb)}
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -437,7 +437,7 @@
const open = {path, opts, mode; -> syscall(Sysopen, cstring(path), opts, mode)}
const close = {fd; -> syscall(Sysclose, fd)}
const creat = {path, mode; -> open(path, Ocreat | Otrunc | Owronly, mode)}
-const read = {fd, buf; -> syscall(Sysread, fd, buf castto(char*), buf.len) castto(size)}
+const read = {fd, buf; -> syscall(Sysread, fd, buf castto(char*), buf.len castto(size)) castto(size)}
const write = {fd, buf; -> syscall(Syswrite, fd, buf castto(char*), buf.len castto(size)) castto(size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, fd, off, whence)}
const fstat = {fd, sb; -> syscall(Sysfstat, fd, sb)}