From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Hollebeek To: egcs@cygnus.com Subject: Re: tmpnam() core dumping Date: Fri, 12 Dec 1997 15:46:00 -0000 Message-id: <199712122335.SAA24029@franck.Princeton.EDU> References: <01BD06E5.D34DA340@bill.icdata.com> X-SW-Source: 1997-12/msg00779.html Bill Ahlbrandt writes ... > > Yes, using -fwritable-strings fixes the problem. > > I wonder why these functions want to modify the string that is passed to them :-)? Normal behavior. Otherwise they would have to call malloc() to allocate the result, or something similar. E.g. from the IRIX man page: tmpnam always generates a file name using the path-prefix defined as P_tmpdir in the header file. If s is NULL, tmpnam leaves its result in an internal static area and returns a pointer to that area. The next call to tmpnam will destroy the contents of the area. If s is not NULL, it is assumed to be the address of an array of at least L_tmpnam bytes, where L_tmpnam is a constant defined in ; tmpnam places its result in that array and returns s. --------------------------------------------------------------------------- Tim Hollebeek | "Everything above is a true email: tim@wfn-shop.princeton.edu | statement, for sufficiently URL: http://wfn-shop.princeton.edu/~tim | false values of true."