lib9p: improve reqqueuecreate()
- open /proc/n/ctl with OCEXEC flag - format pid as ulong - don't leak the fd
This commit is contained in:
parent
b3c9249500
commit
d570229e82
|
@ -16,8 +16,8 @@ _reqqueueproc(void *v)
|
||||||
q = v;
|
q = v;
|
||||||
rfork(RFNOTEG);
|
rfork(RFNOTEG);
|
||||||
|
|
||||||
buf = smprint("/proc/%d/ctl", getpid());
|
buf = smprint("/proc/%lud/ctl", (ulong)getpid());
|
||||||
fd = open(buf, OWRITE);
|
fd = open(buf, OWRITE|OCEXEC);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
for(;;){
|
for(;;){
|
||||||
|
@ -40,6 +40,8 @@ _reqqueueproc(void *v)
|
||||||
f(r);
|
f(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fd >= 0)
|
||||||
|
close(fd);
|
||||||
free(r);
|
free(r);
|
||||||
free(q);
|
free(q);
|
||||||
threadexits(nil);
|
threadexits(nil);
|
||||||
|
|
Loading…
Reference in a new issue