Date: Fri, 27 Oct 1995 13:16:48 -0400 From: "Garrett A. Wollman" <wollman@lcs.mit.edu> To: kedron@tribe.com (Kedron Wolcott) Cc: bugs@freebsd.org Subject: 2.0.5 mktemp bug. Message-ID: <9510271716.AA23164@halloran-eldar.lcs.mit.edu> In-Reply-To: <199510271707.KAA08844@tribe.com> References: <199510271707.KAA08844@tribe.com>
index | next in thread | previous in thread | raw e-mail
<<On Fri, 27 Oct 1995 10:07:51 -0700, kedron@tribe.com (Kedron Wolcott) said:
> However, I do think this is a bug. The program
> ---------
> #include <unistd.h>
> void
> main ( void )
> {
> mktemp( "/tmp/tmp.XXXX" );
> }
> ---------
Your program is wrong. String literals are not modifiable. The
correct code is as follows:
int /* NB: not void */
main(void)
{
char name[] = "/tmp/tmp.XXXX";
mktemp(name); /* NB: using modifiable array, not a literal */
return 0;
}
-GAWollman
--
Garrett A. Wollman | Shashish is simple, it's discreet, it's brief. ...
wollman@lcs.mit.edu | Shashish is the bonding of hearts in spite of distance.
Opinions not those of| It is a bond more powerful than absence. We like people
MIT, LCS, ANA, or NSA| who like Shashish. - Claude McKenzie + Florent Vollant
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9510271716.AA23164>
