From bf7b4c49fb935ada8ce6918c5a96bea2f95de041 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 12 Oct 2006 03:23:15 +0000 Subject: [PATCH] fix the way Plan 9 does --- kern/devmnt.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kern/devmnt.c b/kern/devmnt.c index d03f41c..6924dc8 100644 --- a/kern/devmnt.c +++ b/kern/devmnt.c @@ -220,6 +220,16 @@ mntversion(Chan *c, char *version, int msize, int returnlen) m->msize = f.msize; 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); m->queue = 0; m->rip = 0; @@ -229,18 +239,9 @@ mntversion(Chan *c, char *version, int msize, int returnlen) m->c = c; unlock(&m->lk); - poperror(); /* msg */ poperror(); /* c */ qunlock(&c->umqlock); - k = strlen(f.version); - if(returnlen > 0){ - if(returnlen < k){ - free(msg); - error(Eshort); - } - memmove(version, f.version, k); - } free(msg); return k; }