Subject: Re: mktemp()
To: None <amiga-dev@NetBSD.ORG>
From: Christos Zoulas <christos@deshaw.com>
List: amiga-dev
Date: 03/17/1995 02:49:20
In article <199503170134.UAA06742@cc03du.unity.ncsu.edu> Chris_Mattingly@ncsu.edu writes:
>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";
>  mktemp(temp);
>  return 0;
>}
>
>Has this been fixed in a more current -current than I have?
>

This is not a bug in your system, it is your bug.

You can use:

	char temp[] = "/tmp/temp.XXXXXX";

or even better:
	char *temp, tempb[MAXPATHLEN];
	strcpy(temp = tempb, "/tmp/temp.XXXXXX");


Gcc makes constant strings readonly and puts them in the text segment,
unless you specify -traditional.

christos