aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-10-22 17:14:17 +0000
committerrsc <devnull@localhost>2004-10-22 17:14:17 +0000
commit493f3d0fbf548303a8f468ffffca8476607ee2cd (patch)
tree09358f7184065cba2c2df69fe0eb1d4371b5dd0d /src
parent298f6bd657fd2c0cd6c1fc049be9e2a139e2ae05 (diff)
downloadplan9port-493f3d0fbf548303a8f468ffffca8476607ee2cd.tar.gz
plan9port-493f3d0fbf548303a8f468ffffca8476607ee2cd.tar.bz2
plan9port-493f3d0fbf548303a8f468ffffca8476607ee2cd.zip
make sure a write of 0 bytes does a 0-length write.
Diffstat (limited to 'src')
-rw-r--r--src/libfs/write.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libfs/write.c b/src/libfs/write.c
index 5da27d12..e4b6253d 100644
--- a/src/libfs/write.c
+++ b/src/libfs/write.c
@@ -43,16 +43,18 @@ _fspwrite(Fid *fid, void *buf, long n, vlong offset)
long
fspwrite(Fid *fid, void *buf, long n, vlong offset)
{
- long tot, want, got;
+ long tot, want, got, first;
uint msize;
msize = fid->fs->msize - IOHDRSZ;
tot = 0;
- while(tot < n){
+ first = 1;
+ while(tot < n || first){
want = n - tot;
if(want > msize)
want = msize;
got = _fspwrite(fid, buf, want, offset);
+ first = 0;
if(got < 0){
if(tot == 0)
return got;