aboutsummaryrefslogtreecommitdiff
path: root/libiberty/make-temp-file.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-21 19:29:33 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-21 19:29:33 +0000
commit7e660a1b347c22edd25823d2536c6492a4cd1cf0 (patch)
tree8515fca11132a4e0d7a76c45f57d392a0e4580df /libiberty/make-temp-file.c
parent4db649404a3cdb9ea1f0c1c7aab5bd69d93eed75 (diff)
* make-temp-file.c: Always default DIR_SEPARATOR to '/'.
Don't default P_tmpdir to anything. Try /var/tmp before /usr/tmp. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40706 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/make-temp-file.c')
-rw-r--r--libiberty/make-temp-file.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index 8429624a11f..67efed16a58 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -45,28 +45,11 @@ Boston, MA 02111-1307, USA. */
#include "libiberty.h"
extern int mkstemps PARAMS ((char *, int));
-#ifndef IN_GCC
-#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
-#define DIR_SEPARATOR '\\'
-#endif
-#endif
-
+/* '/' works just fine on MS-DOS based systems. */
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
#endif
-/* On MSDOS, write temp files in current dir
- because there's no place else we can expect to use. */
-/* ??? Although the current directory is tried as a last resort,
- this is left in so that on MSDOS it is preferred to /tmp on the
- off chance that someone requires this, since that was the previous
- behaviour. */
-#ifdef __MSDOS__
-#ifndef P_tmpdir
-#define P_tmpdir "."
-#endif
-#endif
-
/* Name of temporary file.
mktemp requires 6 trailing X's. */
#define TEMP_FILE "ccXXXXXX"
@@ -92,9 +75,11 @@ try (dir, base)
return 0;
}
-static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
-static char usrtmp[] =
+static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
+static const char usrtmp[] =
{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
+static const char vartmp[] =
+{ DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
static char *memoized_tmpdir;
@@ -116,7 +101,8 @@ choose_tmpdir ()
base = try (P_tmpdir, base);
#endif
- /* Try /usr/tmp, then /tmp. */
+ /* Try /var/tmp, /usr/tmp, then /tmp. */
+ base = try (vartmp, base);
base = try (usrtmp, base);
base = try (tmp, base);