Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin

svn:r682
This commit is contained in:
Niels Provos 2008-03-02 01:46:00 +00:00
parent 593b5f99b3
commit 19dad16699
2 changed files with 5 additions and 1 deletions

View File

@ -55,6 +55,7 @@ Changes in current version:
o test support for PUT/DELETE requests; from Josh Rotenberg
o rewrite of the evbuffer code to reduce memory copies
o Some older Solaris versions demand that _REENTRANT be defined to get strtok_r(); do so.
o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.

View File

@ -72,6 +72,7 @@ struct kqop {
struct kevent *events;
int nevents;
int kq;
pid_t pid;
};
void *kq_init (struct event_base *);
@ -114,6 +115,8 @@ kq_init(struct event_base *base)
kqueueop->kq = kq;
kqueueop->pid = getpid();
/* Initalize fields */
kqueueop->changes = event_malloc(NEVENT * sizeof(struct kevent));
if (kqueueop->changes == NULL) {
@ -411,7 +414,7 @@ kq_dealloc(struct event_base *base, void *arg)
event_free(kqop->changes);
if (kqop->events)
event_free(kqop->events);
if (kqop->kq)
if (kqop->kq >= 0 && kqop->pid == getpid())
close(kqop->kq);
memset(kqop, 0, sizeof(struct kqop));
event_free(kqop);