diff options
| author | Charles.Forsyth <devnull@localhost> | 2007-08-14 15:59:48 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2007-08-14 15:59:48 +0000 |
| commit | 8efcc02512b6ae020b366620032686a80b570587 (patch) | |
| tree | 1c9af3907e566f4f6d020ad4132460417e174638 /appl/lib | |
| parent | 1e315792cf7aa8f8b05534070a3c246984514c32 (diff) | |
20070814-1659
Diffstat (limited to 'appl/lib')
| -rw-r--r-- | appl/lib/bufio.b | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/appl/lib/bufio.b b/appl/lib/bufio.b index 5960e310..ab884649 100644 --- a/appl/lib/bufio.b +++ b/appl/lib/bufio.b @@ -88,17 +88,16 @@ readchunk(b: ref Iobuf): int writechunk(b: ref Iobuf): int { - if (b.fd == nil) - return ERROR; + err := (b.fd == nil); if (b.filpos != b.bufpos) { if (sys->seek(b.fd, b.bufpos, 0) != b.bufpos) - return ERROR; + err = 1; b.filpos = b.bufpos; } if ((size := b.size) > Bufsize) size = Bufsize; if (sys->write(b.fd, b.buffer, size) != size) - return ERROR; + err = 1; b.filpos += big size; b.size -= size; if (b.size) { @@ -108,6 +107,8 @@ writechunk(b: ref Iobuf): int b.dirty = 0; b.bufpos += big size; b.index -= size; + if(err) + return ERROR; return size; } @@ -295,7 +296,7 @@ Iobuf.ungetc(b: self ref Iobuf): int stop = 0; buf := b.buffer[0:b.size]; for(i := b.index-1; i >= stop; i--){ - (r, n, s) := sys->byte2char(buf, i); + (nil, n, s) := sys->byte2char(buf, i); if(s && i + n == b.index){ b.index = i; return 1; |
