diff options
author | rsc <devnull@localhost> | 2005-03-01 20:56:27 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-03-01 20:56:27 +0000 |
commit | c31f81ac8b402e72acf552eb9b0740a700000e8b (patch) | |
tree | 518817a9703a3a088a4a3e91ada041d703ec9cc1 /src/lib9pclient | |
parent | 6c78172831f45937b48e96c2bba5bdd04196d020 (diff) | |
download | plan9port-c31f81ac8b402e72acf552eb9b0740a700000e8b.tar.gz plan9port-c31f81ac8b402e72acf552eb9b0740a700000e8b.tar.bz2 plan9port-c31f81ac8b402e72acf552eb9b0740a700000e8b.zip |
open: preserve error on failed open
write: handle offset correctly for fswrite
Diffstat (limited to 'src/lib9pclient')
-rw-r--r-- | src/lib9pclient/open.c | 3 | ||||
-rw-r--r-- | src/lib9pclient/write.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/lib9pclient/open.c b/src/lib9pclient/open.c index e9fb981b..2317bbb7 100644 --- a/src/lib9pclient/open.c +++ b/src/lib9pclient/open.c @@ -7,6 +7,7 @@ CFid* fsopen(CFsys *fs, char *name, int mode) { + char e[ERRMAX]; CFid *fid; Fcall tx, rx; @@ -16,7 +17,9 @@ fsopen(CFsys *fs, char *name, int mode) tx.fid = fid->fid; tx.mode = mode; if(_fsrpc(fs, &tx, &rx, 0) < 0){ + rerrstr(e, sizeof e); fsclose(fid); + errstr(e, sizeof e); return nil; } fid->mode = mode; diff --git a/src/lib9pclient/write.c b/src/lib9pclient/write.c index f4eab964..9f908589 100644 --- a/src/lib9pclient/write.c +++ b/src/lib9pclient/write.c @@ -53,7 +53,7 @@ fspwrite(CFid *fid, void *buf, long n, vlong offset) want = n - tot; if(want > msize) want = msize; - got = _fspwrite(fid, buf, want, offset); + got = _fspwrite(fid, buf+tot, want, offset); first = 0; if(got < 0){ if(tot == 0) |