summaryrefslogtreecommitdiff
path: root/sys/src/9/port/devshr.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2012-02-08 02:32:03 +0100
committercinap_lenrek <cinap_lenrek@rei2.9hal>2012-02-08 02:32:03 +0100
commit061d55111b677de4810fa8fd4a8f05907adaef8b (patch)
treeb07183d6086debf1767aa11a6ea9db9354dd0fc0 /sys/src/9/port/devshr.c
parent022fd02b9632b0ca3ddd9547730446dd222ab93d (diff)
add Etoolong error string, cleanup genbuf truncation fix
Diffstat (limited to 'sys/src/9/port/devshr.c')
-rw-r--r--sys/src/9/port/devshr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/src/9/port/devshr.c b/sys/src/9/port/devshr.c
index f6ef0ae9a..70c477d53 100644
--- a/sys/src/9/port/devshr.c
+++ b/sys/src/9/port/devshr.c
@@ -304,7 +304,7 @@ shrgen(Chan *c, char*, Dirtab*, int, int s, Dir *dp)
qlock(&shrslk);
for(shr = shrs; shr && s; shr = shr->next)
s--;
- if(shr == nil || (strlen(shr->name) >= sizeof(up->genbuf))){
+ if(shr == nil){
qunlock(&shrslk);
return -1;
}
@@ -323,11 +323,11 @@ shrgen(Chan *c, char*, Dirtab*, int, int s, Dir *dp)
rlock(&h->lock);
for(m = h->mount; m && s; m = m->next)
s--;
- mpt = tompt(m);
- if(m == nil || (strlen(mpt->name) >= sizeof(up->genbuf))){
+ if(m == nil){
runlock(&h->lock);
return -1;
}
+ mpt = tompt(m);
kstrcpy(up->genbuf, mpt->name, sizeof up->genbuf);
devdir(c, shrqid(Qcmpt, mpt->id), up->genbuf, 0, mpt->owner, mpt->perm, dp);
runlock(&h->lock);
@@ -461,7 +461,7 @@ shrcreate(Chan *c, char *name, int omode, ulong perm)
if((perm & DMDIR) == 0 || openmode(omode) != OREAD)
error(Eperm);
if(strlen(name) >= sizeof(up->genbuf))
- error(Egreg);
+ error(Etoolong);
qlock(&shrslk);
if(waserror()){
qunlock(&shrslk);
@@ -499,7 +499,7 @@ shrcreate(Chan *c, char *name, int omode, ulong perm)
devpermcheck(shr->owner, shr->perm, ORDWR);
if(strlen(name) >= sizeof(up->genbuf))
- error(Egreg);
+ error(Etoolong);
h = &shr->umh;
wlock(&h->lock);
@@ -657,7 +657,7 @@ shrwstat(Chan *c, uchar *dp, int n)
if(strchr(d.name, '/') != nil)
error(Ebadchar);
if(strlen(d.name) >= sizeof(up->genbuf))
- error(Egreg);
+ error(Etoolong);
kstrdup(&ent->name, d.name);
}
poperror();