[tkined] snmp command causes crash when compiled with gcc

From: Bill Alexander (bill@calynet.com)
Date: Fri Aug 11 2000 - 17:13:58 MET DST


I'm running scotty2.1.10 on Solaris 2.6, and recently switched from Sun cc
to gcc. I noticed that the first time I used the snmp scotty tcl command,
scotty would crash. I was able to get around this with a patch, that I
thought you might like to pick up.

The patch is given below:

===================================================================
RCS file: /home/bill/CVSROOT/calySim/scotty2.1.10/tnm/snmp/tnmSnmpTcl.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** tnmSnmpTcl.c 2000/08/02 23:39:11 1.1
--- tnmSnmpTcl.c 2000/08/03 15:16:50 1.2
***************
*** 662,667 ****
--- 661,667 ----
      int argc;
      char **argv;
  {
+ static char mibCmd[20];
      SNMP_Session *session;
      int code;

***************
*** 728,734 ****
         * mechanism -- ugly but correct in most cases.
         */

! Tcl_Eval(interp, "mib oid 1");
        Tcl_ResetResult(interp);

        /*
--- 728,738 ----
         * mechanism -- ugly but correct in most cases.
         */

! if (mibCmd[0] == 0) {
! strcpy(mibCmd, "mib oid 1"); /* so in volatile memory */
! }
!
! Tcl_Eval(interp, mibCmd);
        Tcl_ResetResult(interp);

        /*

The crash occurs at the Tcl_Eval command - I suspect that gcc handles
string constants in such a way that the (temporary) modifications made
by Tcl_Eval cause a crash.

========================
Bill Alexander
Lead NMS Engineer
Caly Corporation
295 Santa Anna Court
Sunnvale, CA 94085
Phone: 408-730-8800 x231
FAX: 408-730-2448
e-mail: bill@calynet.com

--
!! 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.



This archive was generated by hypermail 2b29 : Mon Jan 08 2001 - 15:27:51 MET