From owner-freebsd-bugs Sat Oct 28 09:53:15 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id JAA28610 for bugs-outgoing; Sat, 28 Oct 1995 09:53:15 -0700 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id JAA28588 for ; Sat, 28 Oct 1995 09:53:08 -0700 Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id RAA23928; Sat, 28 Oct 1995 17:50:47 +0100 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id RAA06251; Sat, 28 Oct 1995 17:50:46 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.6.12/8.6.9) id QAA06414; Sat, 28 Oct 1995 16:33:15 +0100 From: J Wunsch Message-Id: <199510281533.QAA06414@uriah.heep.sax.de> Subject: Re: 2.0.5 mktemp bug. To: kedron@tribe.com Date: Sat, 28 Oct 1995 16:33:15 +0100 (MET) Cc: bugs@freebsd.org Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199510271912.FAA24825@godzilla.zeta.org.au> from "Bruce Evans" at Oct 28, 95 05:12:01 am X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 793 Sender: owner-bugs@freebsd.org Precedence: bulk As Bruce Evans wrote: > > You should copy the string constant to a suitable large non-const ^^^^ > array, e.g., `char foo[32]'. ...or initialize a variable with it: static char template[] = "/tmp/fooXXXXX"; ... mktemp(template); It depends on the application which variant is more appropriate. Btw., this has *not* been the expected behaviour in the pre-ANSI era, so if you're porting a very old program, you could sometimes stumple across this problem. That's why "gcc -traditional" doesn't make constant strings read/only, but you're strongly encouraged to do the right thing instead of relying on this hack. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)