Return to BSD News archive
Newsgroups: comp.os.386bsd.bugs Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!cass.ma02.bull.com!syd.bull.oz.au!melb.bull.oz.au!zen!sjg From: sjg@zen.void.oz.au (Simon J. Gerraty) Subject: Re: mktemp() crashes Organization: Zen programming... References: <CF7snJ.ID9@dvorak.amd.com> Message-ID: <1993Oct21.093717.2658@zen.void.oz.au> Date: Thu, 21 Oct 1993 09:37:17 GMT Lines: 27 helgren@dvorak.amd.com (Matt Helgren) writes: > Im trying to use mkmf to get an application compiled but mkmf keeps >crashing when envoked. Using gdb I find that its dying in the routine >mktemp() which is in one of the system libs. Is there a known bug with mktemp? There is an incompatability between mktemp()'s implementation, many programs use of mktemp() and ANSI-C. mktemp() modifies the string passed to it. many programs call mktemp("fooXXXXX"). gcc puts the string literal in read-only memory - just like ANSI says it should. Result - mktemp() gets a bus error or segmentation violation. Solutions: 1/ use gcc -traditional so that "fooXXXX" is not read-only 2/ fix mktemp() to use a private static array. 3/ modify the program to not call mktemp("fooXXXX"). -- Simon J. Gerraty <sjg@zen.void.oz.au> #include <disclaimer> /* imagine something _very_ witty here */