venti: fix possible nil deref in libventi vtgetreq() and cleanup vacfs (import from sources)
This commit is contained in:
parent
37a93ef857
commit
ef1c186305
3 changed files with 15 additions and 8 deletions
|
@ -1592,6 +1592,11 @@ vacfilesetdir(VacFile *f, VacDir *dir)
|
||||||
f->dir.gid = vtstrdup(dir->gid);
|
f->dir.gid = vtstrdup(dir->gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strcmp(f->dir.mid, dir->mid) != 0){
|
||||||
|
vtfree(f->dir.mid);
|
||||||
|
f->dir.mid = vtstrdup(dir->mid);
|
||||||
|
}
|
||||||
|
|
||||||
f->dir.mtime = dir->mtime;
|
f->dir.mtime = dir->mtime;
|
||||||
f->dir.atime = dir->atime;
|
f->dir.atime = dir->atime;
|
||||||
|
|
||||||
|
@ -1774,7 +1779,7 @@ vacfsopen(VtConn *z, char *file, int mode, int ncache)
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
|
||||||
if(vtparsescore(file, &prefix, score) >= 0){
|
if(vtparsescore(file, &prefix, score) >= 0){
|
||||||
if(strcmp(prefix, "vac") != 0){
|
if(prefix == nil || strcmp(prefix, "vac") != 0){
|
||||||
werrstr("not a vac file");
|
werrstr("not a vac file");
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,12 +200,6 @@ threadmain(int argc, char *argv[])
|
||||||
mfd[0] = p[0];
|
mfd[0] = p[0];
|
||||||
mfd[1] = p[0];
|
mfd[1] = p[0];
|
||||||
srvfd = p[1];
|
srvfd = p[1];
|
||||||
}
|
|
||||||
|
|
||||||
procrfork(srv, 0, Stacksize, RFFDG|RFNAMEG|RFNOTEG);
|
|
||||||
|
|
||||||
if(!stdio){
|
|
||||||
close(p[0]);
|
|
||||||
if(defsrv){
|
if(defsrv){
|
||||||
srvname = smprint("/srv/%s", defsrv);
|
srvname = smprint("/srv/%s", defsrv);
|
||||||
fd = create(srvname, OWRITE|ORCLOSE, 0666);
|
fd = create(srvname, OWRITE|ORCLOSE, 0666);
|
||||||
|
@ -215,6 +209,12 @@ threadmain(int argc, char *argv[])
|
||||||
sysfatal("write %s: %r", srvname);
|
sysfatal("write %s: %r", srvname);
|
||||||
free(srvname);
|
free(srvname);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
procrfork(srv, 0, Stacksize, RFFDG|RFNAMEG|RFNOTEG);
|
||||||
|
|
||||||
|
if(!stdio){
|
||||||
|
close(p[0]);
|
||||||
if(defmnt){
|
if(defmnt){
|
||||||
if(mount(srvfd, -1, defmnt, MREPL|MCREATE, "") < 0)
|
if(mount(srvfd, -1, defmnt, MREPL|MCREATE, "") < 0)
|
||||||
sysfatal("mount %s: %r", defmnt);
|
sysfatal("mount %s: %r", defmnt);
|
||||||
|
|
|
@ -180,7 +180,9 @@ vtgetreq(VtSrv *srv)
|
||||||
VtReq *r;
|
VtReq *r;
|
||||||
|
|
||||||
r = _vtqrecv(srv->q);
|
r = _vtqrecv(srv->q);
|
||||||
vtlog(VtServerLog, "<font size=-1>%T %s:</font> vtgetreq %F<br>\n", ((VtSconn*)r->sc)->c->addr, &r->tx);
|
if (r != nil)
|
||||||
|
vtlog(VtServerLog, "<font size=-1>%T %s:</font> vtgetreq %F<br>\n",
|
||||||
|
((VtSconn*)r->sc)->c->addr, &r->tx);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue