Re: [tkined] BUG coredump scotty

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Wed, 16 Dec 1998 16:25:21 +0100

>>>>> petrus vloet writes:

petrus> Tried to set up a SNMP listener, but this caused a core dump.

[snip]

petrus> First workaround is to check if trap_channel != nil.

Right. This happens on all UNIX platforms. Below is the patch for this
and a related problem which will be in the next snapshot.

Juergen
Index: tnmUnixSnmp.c
===================================================================
RCS file: /usr/home/schoenw/CVS/scotty/unix/tnmUnixSnmp.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- tnmUnixSnmp.c 1998/10/28 15:33:03 1.6
+++ tnmUnixSnmp.c 1998/12/02 20:20:27 1.7
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * @(#) $Id: tnmUnixSnmp.c,v 1.6 1998/10/28 15:33:03 schoenw Exp $
+ * @(#) $Id: tnmUnixSnmp.c,v 1.7 1998/12/02 20:20:27 schoenw Exp $
*/

#include "tnmSnmp.h"
@@ -141,6 +141,12 @@
return TCL_ERROR;
}
}
+
+ if (Tcl_SetChannelOption(interp, trap_channel,
+ "-translation", "binary") != TCL_OK) {
+ (void) Tcl_Close((Tcl_Interp *) NULL, trap_channel);
+ return TCL_ERROR;
+ }

Tcl_RegisterChannel((Tcl_Interp *) NULL, trap_channel);
Tcl_CreateChannelHandler(trap_channel, TCL_READABLE,
@@ -167,8 +173,11 @@
void
TnmSnmpTrapClose()
{
- Tcl_UnregisterChannel((Tcl_Interp *) NULL, trap_channel);
- Tcl_ReapDetachedProcs();
+ if (trap_channel) {
+ Tcl_UnregisterChannel((Tcl_Interp *) NULL, trap_channel);
+ trap_channel = NULL;
+ Tcl_ReapDetachedProcs();
+ }
}

/*

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.