mirror of git://gcc.gnu.org/git/gcc.git
make-temp-file.c: Always default DIR_SEPARATOR to '/'.
* make-temp-file.c: Always default DIR_SEPARATOR to '/'. Don't default P_tmpdir to anything. Try /var/tmp before /usr/tmp. From-SVN: r40706
This commit is contained in:
parent
edb7d731b6
commit
49ee944b86
|
|
@ -1,3 +1,9 @@
|
||||||
|
2001-03-21 Zack Weinberg <zackw@stanford.edu>
|
||||||
|
|
||||||
|
* make-temp-file.c: Always default DIR_SEPARATOR to '/'.
|
||||||
|
Don't default P_tmpdir to anything. Try /var/tmp before
|
||||||
|
/usr/tmp.
|
||||||
|
|
||||||
2001-03-20 Zack Weinberg <zackw@stanford.edu>
|
2001-03-20 Zack Weinberg <zackw@stanford.edu>
|
||||||
|
|
||||||
* choose-temp.c: Split off make_temp_file, and the code
|
* choose-temp.c: Split off make_temp_file, and the code
|
||||||
|
|
|
||||||
|
|
@ -45,28 +45,11 @@ Boston, MA 02111-1307, USA. */
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
extern int mkstemps PARAMS ((char *, int));
|
extern int mkstemps PARAMS ((char *, int));
|
||||||
|
|
||||||
#ifndef IN_GCC
|
/* '/' works just fine on MS-DOS based systems. */
|
||||||
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
|
|
||||||
#define DIR_SEPARATOR '\\'
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DIR_SEPARATOR
|
#ifndef DIR_SEPARATOR
|
||||||
#define DIR_SEPARATOR '/'
|
#define DIR_SEPARATOR '/'
|
||||||
#endif
|
#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.
|
/* Name of temporary file.
|
||||||
mktemp requires 6 trailing X's. */
|
mktemp requires 6 trailing X's. */
|
||||||
#define TEMP_FILE "ccXXXXXX"
|
#define TEMP_FILE "ccXXXXXX"
|
||||||
|
|
@ -92,9 +75,11 @@ try (dir, base)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||||
static char usrtmp[] =
|
static const char usrtmp[] =
|
||||||
{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
{ 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;
|
static char *memoized_tmpdir;
|
||||||
|
|
||||||
|
|
@ -116,7 +101,8 @@ choose_tmpdir ()
|
||||||
base = try (P_tmpdir, base);
|
base = try (P_tmpdir, base);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Try /usr/tmp, then /tmp. */
|
/* Try /var/tmp, /usr/tmp, then /tmp. */
|
||||||
|
base = try (vartmp, base);
|
||||||
base = try (usrtmp, base);
|
base = try (usrtmp, base);
|
||||||
base = try (tmp, base);
|
base = try (tmp, base);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue