If we run out of chat script immediately after a successfully executed

expect-send-expect sequence, finish gracefully, don't core dump.
This bug has been there for over a year - I could never reproduce it !

Straw provided by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
This commit is contained in:
Brian Somers 1999-06-26 02:54:24 +00:00
parent 67812eacd7
commit 6a32b41413

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: chat.c,v 1.56 1999/05/27 09:50:10 brian Exp $
* $Id: chat.c,v 1.57 1999/06/09 08:47:31 brian Exp $
*/
#include <sys/param.h>
@ -181,7 +181,11 @@ chat_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
} else {
int minus;
c->argptr = c->argv[++c->arg];
if ((c->argptr = c->argv[++c->arg]) == NULL) {
/* End of script - all ok */
c->state = CHAT_DONE;
return 0;
}
if (c->state == CHAT_EXPECT) {
/* Look for expect-send-expect sequence */