Subject: Re: mktemp()
To: None <Chris_Mattingly@ncsu.edu>
From: Adam Glass <glass@NetBSD.ORG>
Date: 03/16/1995 17:53:12
> In attempting to compile a program that uses mktemp(), I had 0% success.
> It causes a bus error every time...
> Ex. prog.:
> #include <unistd.h>
> int main()
> char *temp;
> temp = "/tmp/temp.XXXXXX";
> return 0;
> Has this been fixed in a more current -current than I have?
As you've written this, mktemp must be able to write to the string
pointed to by temp. GCC puts string constants in text space so they
aren't writeable and thus mktemp() goes boom. Try this instead:
char temp = "/tmp/temp.XXXXXX";