Be careful that the current or next prompt in the list
that we're iterating through doesn't get changed by
descriptor_Read().
This commit is contained in:
Brian Somers 1998-08-02 13:01:16 +00:00
parent b177082524
commit 0bdcbcbe9b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38013
3 changed files with 11 additions and 4 deletions

View File

@ -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 <sys/types.h>
@ -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++;
}
}

View File

@ -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 *);

View File

@ -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 <sys/types.h>
@ -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