Patch #: 49 Type: bug fix Priority: medium Affects: users of aarpd with error condition Reported: David Hornsby Archived: munnari.OZ.AU mac/cap.patches/cap60.patch049 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch049' Summary: cleanup error handling to avoid silly core dumps File: cap60/support/ethertalk/ethertalk.c File: cap60/support/ethertalk/aarpd.c *** support/ethertalk/ethertalk.c.orig Mon Jul 1 16:48:31 1991 --- support/ethertalk/ethertalk.c Tue Aug 27 20:58:12 1991 *************** *** 1,6 **** ! static char rcsid[] = "$Author: djh $ $Date: 1991/07/01 06:48:16 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/support/ethertalk/RCS/ethertalk.c,v 2.4 1991/07/01 06:48:16 djh Rel djh $"; ! static char revision[] = "$Revision: 2.4 $"; /* * ethertalk.c - ethertalk interface --- 1,6 ---- ! static char rcsid[] = "$Author: djh $ $Date: 1991/08/27 10:58:03 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/support/ethertalk/RCS/ethertalk.c,v 2.5 1991/08/27 10:58:03 djh Rel djh $"; ! static char revision[] = "$Revision: 2.5 $"; /* * ethertalk.c - ethertalk interface *************** *** 137,149 **** IDESC_TYPE *id; int async; { - int etph; E_HANDLE *eh; int hostid; if ((eh = (E_HANDLE *)malloc(sizeof(E_HANDLE))) == NULL) ! return(NULL); pi_setup(); --- 137,148 ---- IDESC_TYPE *id; int async; { E_HANDLE *eh; int hostid; if ((eh = (E_HANDLE *)malloc(sizeof(E_HANDLE))) == NULL) ! return(FALSE); pi_setup(); *************** *** 150,159 **** /* init for a single node */ eh->eh_ah = (caddr_t)aarp_init(id->id_intf, id->id_intfno, 1); if (eh->eh_ah == NULL) { - logit(LOG_LOG|L_UERR, "aarp_init"); - pi_close(etph); free(eh); ! return(NULL); } /* link in both directions */ id->id_ifuse = (caddr_t)eh; /* mark */ --- 149,156 ---- /* init for a single node */ eh->eh_ah = (caddr_t)aarp_init(id->id_intf, id->id_intfno, 1); if (eh->eh_ah == NULL) { free(eh); ! return(FALSE); } /* link in both directions */ id->id_ifuse = (caddr_t)eh; /* mark */ *************** *** 170,185 **** hostid = 0xff & gethostid(); /* use last byte of hostid as hint */ else hostid = this_node; if (etalk_getnode(eh, hostid, etalk_initfinish) < 0) { - pi_close(etph); free(eh); } if (async) /* async means to stop early */ return(TRUE); /* wait for node acquisition? */ while (eh->eh_state == ELAP_WAITING) abSleep(10, TRUE); return(eh->eh_state == ELAP_READY); /* true if okay, 0 o.w. */ } --- 167,185 ---- hostid = 0xff & gethostid(); /* use last byte of hostid as hint */ else hostid = this_node; + if (etalk_getnode(eh, hostid, etalk_initfinish) < 0) { free(eh); + return(FALSE); } if (async) /* async means to stop early */ return(TRUE); + /* wait for node acquisition? */ while (eh->eh_state == ELAP_WAITING) abSleep(10, TRUE); + return(eh->eh_state == ELAP_READY); /* true if okay, 0 o.w. */ } *** support/ethertalk/aarpd.c.orig Fri Jul 26 01:59:55 1991 --- support/ethertalk/aarpd.c Tue Aug 27 20:59:07 1991 *************** *** 231,238 **** if (dbug.db_flgs || (dlevel != 0)) printf("Interface %s%d, zone %s, ", id.id_intf, id.id_intfno, id.id_zone+1); ! init_fdlistening(); /* low level scheduler */ ! etalk_init(&id, FALSE); /* set up EtherTalk */ ea = etalk_mynode(&id); this_node = nis_node = ea->node; --- 231,241 ---- if (dbug.db_flgs || (dlevel != 0)) printf("Interface %s%d, zone %s, ", id.id_intf, id.id_intfno, id.id_zone+1); ! init_fdlistening(); /* low level scheduler */ ! if (!etalk_init(&id, FALSE)) { /* set up EtherTalk */ ! fprintf(stderr, "init_enet: network initialization failed\n"); ! exit(1); ! } ea = etalk_mynode(&id); this_node = nis_node = ea->node; *** README.orig Tue Aug 27 20:59:40 1991 --- README Tue Aug 27 20:59:57 1991 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 48, August 1991 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 49, August 1991 Introduction ------------