more hjfs fixes

This commit is contained in:
aiju 2012-08-08 00:52:37 +02:00
parent 34bf0ce496
commit f2c70fe2f7
3 changed files with 11 additions and 5 deletions

View file

@ -21,8 +21,7 @@ static int
walkpath(Chan *ch, char *path, char **cr)
{
char buf[NAMELEN], *p, *fp;
buf[NAMELEN - 1] = 0;
fp = path;
if(*path != '/'){
noent:
@ -51,6 +50,7 @@ walkpath(Chan *ch, char *path, char **cr)
break;
if(p - path >= NAMELEN)
goto noent;
memset(buf, 0, sizeof buf);
memcpy(buf, path, p - path);
if(chanwalk(ch, buf) <= 0){
werrstr("%s: %r", fp);

View file

@ -115,6 +115,8 @@ again:
runlock(fs);
wlock(fs);
}
if(l->next != nil && willmodify(fs, l->next, 1) < 0)
goto err;
rc = chref(fs, l->blk, 0);
if(rc < 0)
goto err;
@ -125,8 +127,7 @@ again:
}
if(rc == 1)
goto done;
if(willmodify(fs, l->next, 1) < 0)
goto err;
p = getbuf(fs->d, l->next->blk, TDENTRY, 0);
if(p == nil)
goto err;

View file

@ -387,7 +387,10 @@ putloc(Fs *fs, Loc *l, int loop)
Buf *b;
qlock(&fs->loctree);
if(!loop && --l->ref <= 0)
goto freeit;
while(loop && l != nil && l->ref <= 1){
freeit:
if((l->flags & LGONE) != 0){
b = getbuf(fs->d, l->blk, TDENTRY, 0);
if(b != nil){
@ -558,12 +561,14 @@ getblk(Fs *fs, FLoc *L, Buf *bd, uvlong blk, uvlong *r, int mode)
return -1;
memset(b->offs, 0, sizeof(b->offs));
}else{
if(mode != GBREAD && chref(fs, *loc, 0) > 1)
if(mode != GBREAD && chref(fs, *loc, 0) > 1){
if(dumpblk(fs, L, loc) < 0){
if(b != bd)
putbuf(b);
return -1;
}
b->op |= BDELWRI;
}
k = *loc;
if(b != bd)
putbuf(b);