ar@mcdd1 (Alastair Rae) (04/09/91)
Is it just on my machine (UMAX V.3) that tgif crashs all the time? I recently down-loaded it from comp.sources.x. It starts up ok & lets me draw some images but core dumps every so often. Is tgif normally reliable? On SYS V? Has anyone found any bugs in it? -- Alastair Rae : uunet!ukc!mcdd1!ar : +44 442 272071 : *Usual disclaimer*
andy@xwkg.Icom.Com (Andrew H. Marrinson) (04/16/91)
No, it isn't just you. I had to make the following change to msg.c (in addition to a handful of other stuff for System V that you presumably found already): *** msg.c~ Thu Mar 21 15:46:00 1991 --- msg.c Thu Mar 21 16:57:32 1991 *************** *** 38,44 **** if (*Msg == '\0') { topMsgNumber = msgCount; return; } ! s = (char *) calloc (strlen (Msg), sizeof(char)); msg_ptr = (struct MsgRec *) calloc (1, sizeof(struct MsgRec)); strcpy (s, Msg); --- 38,44 ---- if (*Msg == '\0') { topMsgNumber = msgCount; return; } ! s = (char *) calloc (strlen (Msg) + 1, sizeof(char)); msg_ptr = (struct MsgRec *) calloc (1, sizeof(struct MsgRec)); strcpy (s, Msg); -------------- END OF PATCH ------------- It seems as though some mallocs always allocate a little bit more memory than you ask for. I found a virtually identical bug in the CMU SNMP client. The System V malloc is not so forgiving! I haven't sent this bug fix to the author of tgif yet. I suppose I ought to... Hope this helps... -- Andrew H. Marrinson Icom Systems, Inc. Wheeling, IL, USA (andy@icom.icom.com)
ar@mcdd1 (Alastair Rae) (04/17/91)
Thanks to all who replied to my original posting. Buggie calls to calloc were causing corruption. I've had a patch from Wayne Richardson <wdr@ibm.com>: ------------------------- *** msg.c.old Tue Apr 2 01:16:27 1991 --- msg.c Fri Apr 12 16:49:25 1991 *************** *** 39,45 **** if (*Msg == '\0') { topMsgNumber = msgCount; return; } ! s = (char *) calloc (strlen (Msg), sizeof(char)); msg_ptr = (struct MsgRec *) calloc (1, sizeof(struct MsgRec)); strcpy (s, Msg); --- 39,45 ---- if (*Msg == '\0') { topMsgNumber = msgCount; return; } ! s = (char *) calloc (1+strlen (Msg), sizeof(char)); msg_ptr = (struct MsgRec *) calloc (1, sizeof(struct MsgRec)); strcpy (s, Msg); *** xbitmap.c.old Wed Apr 3 16:57:09 1991 --- xbitmap.c Fri Apr 12 16:51:50 1991 *************** *** 298,304 **** pixelValue[0] = myBgPixel; colorChar[0] = '`'; ! colorStr[0] = (char *) calloc (strlen(myBgColorStr), sizeof(char)); strcpy (colorStr[0], myBgColorStr); numColorsToDump = 1; --- 298,304 ---- pixelValue[0] = myBgPixel; colorChar[0] = '`'; ! colorStr[0] = (char *) calloc (1+strlen(myBgColorStr), sizeof(char)); strcpy (colorStr[0], myBgColorStr); numColorsToDump = 1; -- Alastair Rae : uunet!ukc!mcdd1!ar : +44 442 272071 : *Usual disclaimer*