From 5df6ee39d73d0df15534caa79e99d10cca8bf63d Mon Sep 17 00:00:00 2001 From: bostic Date: Tue, 3 Dec 1996 18:13:58 +0000 Subject: [PATCH] if the underlying function returns non-zero, we have to quit processing this is used by the Motif code. --- ipc/ip_trans.c | 18 +++++++++--------- motif_l/m_func.c | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ipc/ip_trans.c b/ipc/ip_trans.c index 15f883c6..a0a6fcd8 100644 --- a/ipc/ip_trans.c +++ b/ipc/ip_trans.c @@ -8,7 +8,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ip_trans.c,v 8.4 1996/12/03 11:22:04 bostic Exp $ (Berkeley) $Date: 1996/12/03 11:22:04 $"; +static const char sccsid[] = "$Id: ip_trans.c,v 8.5 1996/12/03 18:13:58 bostic Exp $ (Berkeley) $Date: 1996/12/03 18:13:58 $"; #endif /* not lint */ #include @@ -41,10 +41,11 @@ ip_trans(bp, lenp) extern int (*iplist[IPO_EVENT_MAX - 1]) __P((IP_BUF *)); IP_BUF ipb; size_t len, needlen; + int foff; char *fmt, *p, *s_bp; - for (s_bp = bp, len = *lenp; len > 0; bp += needlen, len -= needlen) { - switch (bp[0]) { + for (s_bp = bp, len = *lenp; len > 0;) { + switch (foff = bp[0]) { case IPO_ADDSTR: case IPO_RENAME: fmt = "s"; @@ -63,8 +64,8 @@ ip_trans(bp, lenp) fmt = ""; } - needlen = IPO_CODE_LEN; p = bp + IPO_CODE_LEN; + needlen = IPO_CODE_LEN; for (; *fmt != '\0'; ++fmt) switch (*fmt) { case '1': @@ -97,13 +98,12 @@ ip_trans(bp, lenp) p += ipb.len; break; } - - /* Check for out-of-band events. */ - if (bp[0] > IPO_EVENT_MAX) - abort(); + bp += needlen; + len -= needlen; /* Call the underlying routine. */ - (void)iplist[bp[0] - 1](&ipb); + if (foff <= IPO_EVENT_MAX && iplist[foff - 1](&ipb)) + break; } partial: if ((*lenp = len) != 0) diff --git a/motif_l/m_func.c b/motif_l/m_func.c index 2a62898d..47a2d8cc 100644 --- a/motif_l/m_func.c +++ b/motif_l/m_func.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: m_func.c,v 8.4 1996/12/03 12:07:08 bostic Exp $ (Berkeley) $Date: 1996/12/03 12:07:08 $"; +static const char sccsid[] = "$Id: m_func.c,v 8.5 1996/12/03 18:14:22 bostic Exp $ (Berkeley) $Date: 1996/12/03 18:14:22 $"; #endif /* not lint */ #include @@ -144,7 +144,7 @@ ipo_deleteln(ipbp) /* Need to let X take over. */ XmUpdateDisplay(cur_screen->area); - return (0); + return (1); } int @@ -204,7 +204,7 @@ ipo_insertln(ipbp) /* Need to let X take over. */ XmUpdateDisplay(cur_screen->area); - return (0); + return (1); } int -- 2.11.4.GIT