From 76039265401440844e2b890ed20a14378596a974 Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 2 Aug 1998 13:01:16 +0000 Subject: [PATCH] PR: 7469 Be careful that the current or next prompt in the list that we're iterating through doesn't get changed by descriptor_Read(). --- usr.sbin/ppp/log.c | 4 +++- usr.sbin/ppp/log.h | 3 ++- usr.sbin/ppp/server.c | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ppp/log.c b/usr.sbin/ppp/log.c index 0c9c276bdcb..acc76f5767a 100644 --- a/usr.sbin/ppp/log.c +++ b/usr.sbin/ppp/log.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: log.c,v 1.30 1998/06/15 19:06:15 brian Exp $ + * $Id: log.c,v 1.31 1998/06/15 19:06:48 brian Exp $ */ #include @@ -68,6 +68,7 @@ static u_long LogMask = MSK(LogPHASE); static u_long LogMaskLocal = MSK(LogERROR) | MSK(LogALERT) | MSK(LogWARN); static int LogTunno = -1; static struct prompt *promptlist; /* Where to log local stuff */ +int log_PromptListChanged; struct prompt * log_PromptList() @@ -123,6 +124,7 @@ log_UnRegisterPrompt(struct prompt *prompt) break; } LogSetMaskLocal(); + log_PromptListChanged++; } } diff --git a/usr.sbin/ppp/log.h b/usr.sbin/ppp/log.h index 3f8969ca352..399cde98f13 100644 --- a/usr.sbin/ppp/log.h +++ b/usr.sbin/ppp/log.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: log.h,v 1.19 1998/05/21 21:46:30 brian Exp $ + * $Id: log.h,v 1.20 1998/05/23 22:24:41 brian Exp $ */ #define LogMIN (1) @@ -81,6 +81,7 @@ extern int log_ShowLevel(struct cmdargs const *); extern int log_SetLevel(struct cmdargs const *); extern int log_ShowWho(struct cmdargs const *); +extern int log_PromptListChanged; extern void log_RegisterPrompt(struct prompt *); extern void log_UnRegisterPrompt(struct prompt *); extern void log_DestroyPrompts(struct server *); diff --git a/usr.sbin/ppp/server.c b/usr.sbin/ppp/server.c index 3fb1de57c14..2a6ccfe77bf 100644 --- a/usr.sbin/ppp/server.c +++ b/usr.sbin/ppp/server.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: server.c,v 1.21 1998/06/24 19:33:36 brian Exp $ + * $Id: server.c,v 1.22 1998/06/27 14:18:10 brian Exp $ */ #include @@ -152,9 +152,13 @@ server_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset) } } + log_PromptListChanged = 0; for (p = log_PromptList(); p; p = p->next) - if (descriptor_IsSet(&p->desc, fdset)) + if (descriptor_IsSet(&p->desc, fdset)) { descriptor_Read(&p->desc, bundle, fdset); + if (log_PromptListChanged) + break; + } } static int -- 2.45.2