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
1 changed files with 4 additions and 2 deletions
|
@ -16,8 +16,8 @@ _reqqueueproc(void *v)
|
|||
q = v;
|
||||
rfork(RFNOTEG);
|
||||
|
||||
buf = smprint("/proc/%d/ctl", getpid());
|
||||
fd = open(buf, OWRITE);
|
||||
buf = smprint("/proc/%lud/ctl", (ulong)getpid());
|
||||
fd = open(buf, OWRITE|OCEXEC);
|
||||
free(buf);
|
||||
|
||||
for(;;){
|
||||
|
@ -40,6 +40,8 @@ _reqqueueproc(void *v)
|
|||
f(r);
|
||||
}
|
||||
|
||||
if(fd >= 0)
|
||||
close(fd);
|
||||
free(r);
|
||||
free(q);
|
||||
threadexits(nil);
|
||||
|
|
Loading…
Reference in a new issue