re PR ada/34553 (Unsafe calls to mktemp and tmpname)

gcc/ada/
	PR ada/34553
	* adaint.c (__gnat_open_new_temp, __gnat_tmp_name): Use mkstemp()
	instead of mktemp() or tmpnam() on NetBSD.

From-SVN: r131201
This commit is contained in:
Samuel Tardieu 2007-12-27 13:04:14 +00:00 committed by Samuel Tardieu
parent 83588991c1
commit 18bc9ccabb
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2007-12-27 Samuel Tardieu <sam@rfc1149.net>
PR ada/34553
* adaint.c (__gnat_open_new_temp, __gnat_tmp_name): Use mkstemp()
instead of mktemp() or tmpnam() on NetBSD.
2007-12-23 Eric Botcazou <ebotcazou@adacore.com>
* trans.c (call_to_gnu): Make the temporary for non-addressable

View file

@ -887,7 +887,8 @@ __gnat_open_new_temp (char *path, int fmode)
strcpy (path, "GNAT-XXXXXX");
#if (defined (__FreeBSD__) || defined (linux)) && !defined (__vxworks)
#if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (linux)) && \
!defined (__vxworks)
return mkstemp (path);
#elif defined (__Lynx__)
mktemp (path);
@ -979,7 +980,7 @@ __gnat_tmp_name (char *tmp_filename)
free (pname);
}
#elif defined (linux) || defined (__FreeBSD__)
#elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__)
#define MAX_SAFE_PATH 1000
char *tmpdir = getenv ("TMPDIR");