summaryrefslogtreecommitdiff
path: root/libstd/blat.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-09-29 13:55:12 -0400
committerOri Bernstein <ori@eigenstate.org>2014-09-29 13:56:03 -0400
commitc92d7552d23497a2e5d6d813e8ed35c612c7dcb3 (patch)
treeb8db3976b5bfd06f1b626126426aad33ca7b2ee5 /libstd/blat.myr
parente414e8418b0ca9dd8d49894d96ef37b12276da16 (diff)
downloadmc-c92d7552d23497a2e5d6d813e8ed35c612c7dcb3.tar.gz
Only succeed blatting if we write the whole buffer.
Writing without error isn't quite the right condition.
Diffstat (limited to 'libstd/blat.myr')
-rw-r--r--libstd/blat.myr6
1 files changed, 4 insertions, 2 deletions
diff --git a/libstd/blat.myr b/libstd/blat.myr
index 32c105d..12f6979 100644
--- a/libstd/blat.myr
+++ b/libstd/blat.myr
@@ -23,11 +23,13 @@ const fblat = {fd, buf
n = 0
while true
written = write(fd, buf[n:])
- if written <= 0
+ if written == 0
goto done
+ elif written < 0
+ goto fail
;;
n += written
;;
:done
- -> written == 0
+ -> written == 0 && n == buf.len
}