fix the way Plan 9 does

This commit is contained in:
Russ Cox 2006-10-12 03:23:15 +00:00
parent d4753beb37
commit bf7b4c49fb
1 changed files with 10 additions and 9 deletions

View File

@ -220,6 +220,16 @@ mntversion(Chan *c, char *version, int msize, int returnlen)
m->msize = f.msize; m->msize = f.msize;
unlock(&mntalloc.lk); unlock(&mntalloc.lk);
k = strlen(f.version);
if(returnlen > 0){
if(returnlen < k)
error(Eshort);
memmove(version, f.version, k);
}
poperror(); /* msg */
free(msg);
lock(&m->lk); lock(&m->lk);
m->queue = 0; m->queue = 0;
m->rip = 0; m->rip = 0;
@ -229,18 +239,9 @@ mntversion(Chan *c, char *version, int msize, int returnlen)
m->c = c; m->c = c;
unlock(&m->lk); unlock(&m->lk);
poperror(); /* msg */
poperror(); /* c */ poperror(); /* c */
qunlock(&c->umqlock); qunlock(&c->umqlock);
k = strlen(f.version);
if(returnlen > 0){
if(returnlen < k){
free(msg);
error(Eshort);
}
memmove(version, f.version, k);
}
free(msg); free(msg);
return k; return k;
} }