From e087fdd81c5f4bf07d629811f5cec2a27b8377f8 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sun, 7 Aug 2005 00:57:46 +0200 Subject: [PATCH] io.h: Change DEFAULT_TEMPDIR to /tmp instead of /var/tmp. * io/io.h: Change DEFAULT_TEMPDIR to /tmp instead of /var/tmp. * io/unix.c (tempfile): Look at the TEMP environment variable to find the temporary files directory. Whitespace correction. From-SVN: r102822 --- libgfortran/ChangeLog | 8 +++++++- libgfortran/io/io.h | 2 +- libgfortran/io/unix.c | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 79e8f9bfe58..cff23fabcee 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,4 +1,10 @@ -2005-08-04 Francois-Xavier Coudert +2005-08-07 Francois-Xavier Coudert + + * io/io.h: Change DEFAULT_TEMPDIR to /tmp instead of /var/tmp. + * io/unix.c (tempfile): Look at the TEMP environment variable + to find the temporary files directory. Whitespace correction. + +2005-08-06 Francois-Xavier Coudert * io/unix.c: Add O_RDWR to open() call. diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 37bdb3ebdfa..3c932fc6303 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA. */ #include #include "libgfortran.h" -#define DEFAULT_TEMPDIR "/var/tmp" +#define DEFAULT_TEMPDIR "/tmp" /* Basic types used in data transfers. */ diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 56df254d380..e6b0478af23 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -983,6 +983,8 @@ tempfile (void) tempdir = getenv ("GFORTRAN_TMPDIR"); if (tempdir == NULL) tempdir = getenv ("TMP"); + if (tempdir == NULL) + tempdir = getenv ("TEMP"); if (tempdir == NULL) tempdir = DEFAULT_TEMPDIR; @@ -998,7 +1000,7 @@ tempfile (void) if (mktemp (template)) do - fd = open (template, O_RDWR |O_CREAT | O_EXCL, S_IREAD | S_IWRITE); + fd = open (template, O_RDWR | O_CREAT | O_EXCL, S_IREAD | S_IWRITE); while (!(fd == -1 && errno == EEXIST) && mktemp (template)); else fd = -1;