Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 1995 05:12:01 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bugs@freebsd.org, kedron@tribe.com
Subject:   Re: 2.0.5 mktemp bug.
Message-ID:  <199510271912.FAA24825@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>However, I do think this is a bug.  The program

>---------
>#include <unistd.h>

>void
>main ( void )
>{
>  mktemp( "/tmp/tmp.XXXX" );
>}
>---------

>gives me a bus-error core dump.  I'm running FreeBSD release 2.0.5 #0, and
>I compiled the program with GCC-2.6.3.

mktemp() modifies the string passed to it, so the string must be in
writable storage.  String constants are read only in FreeBSD+gcc.
You should copy the string constant to a suitable large non-const
array, e.g., `char foo[32]'.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510271912.FAA24825>