schedular() call can now modify fd mask so make the working copy just

before calling select(); otherwise it can contain bad file descriptors
This commit is contained in:
tteras 2008-12-30 15:50:24 +00:00
parent a7f7726d50
commit a3c1a92d23
2 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-12-30 Timo Teras <timo.teras@iki.fi>
* src/racoon/session.c: reset working copy of select mask after
call to schedular() as it can change file descriptor mask
(this was broken by my commit on 2008-12-23)
2008-12-23 Timo Teras <timo.teras@iki.fi>
* src/racoon/{admin.c|admin_var.h|cfparse.y|debug.h|evt.c|evt.h|
grabmyaddr.c|grabmyaddr.h|handler.h|isakmp.c|isakmp_inf.c|

View File

@ -1,4 +1,4 @@
/* $NetBSD: session.c,v 1.21 2008/12/23 14:03:12 tteras Exp $ */
/* $NetBSD: session.c,v 1.22 2008/12/30 15:50:25 tteras Exp $ */
/* $KAME: session.c,v 1.32 2003/09/24 02:01:17 jinmei Exp $ */
@ -269,11 +269,6 @@ session(void)
sigreq[i] = 0;
while (1) {
if (dying)
rfds = maskdying;
else
rfds = mask0;
/*
* asynchronous requests via signal.
* make sure to reset sigreq to 0.
@ -282,6 +277,14 @@ session(void)
/* scheduling */
timeout = schedular();
/* schedular can change select() mask, so we reset
* the working copy here */
if (dying)
rfds = maskdying;
else
rfds = mask0;
error = select(nfds + 1, &rfds, NULL, NULL, timeout);
if (error < 0) {
switch (errno) {