diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-03-24 01:15:01 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-03-24 01:15:01 +0000 |
commit | 666065313efd5e2b8f66a58730171c8646e00196 (patch) | |
tree | 10c4dee82da9e8a0a24dc9ecb72fee7807ba8ea8 /Build/source/texk | |
parent | 82efcfabb5d004586f748c9ea7c7e02480a5451b (diff) |
Change dpx_create_temp_file() because tmpnam() sometimes fails on Windows.
git-svn-id: svn://tug.org/texlive/trunk@29486 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/dvipdfmx/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/src/dpxfile.c | 26 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dpxfile.c | 26 |
4 files changed, 60 insertions, 2 deletions
diff --git a/Build/source/texk/dvipdfmx/ChangeLog b/Build/source/texk/dvipdfmx/ChangeLog index f18aef8c9a2..7868f303b4b 100644 --- a/Build/source/texk/dvipdfmx/ChangeLog +++ b/Build/source/texk/dvipdfmx/ChangeLog @@ -1,3 +1,8 @@ +2013-03-24 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * src/dpxfile.c: Change dpx_create_temp_file() because tmpnam() + sometimes fails on Windows. + 2013-02-25 Peter Breitenlohner <peb@mppmu.mpg.de> * src/dpxutil.[ch]: Reduce diffs with xdvipdfmx. diff --git a/Build/source/texk/dvipdfmx/src/dpxfile.c b/Build/source/texk/dvipdfmx/src/dpxfile.c index 8dc0cabe8b4..bb827489649 100644 --- a/Build/source/texk/dvipdfmx/src/dpxfile.c +++ b/Build/source/texk/dvipdfmx/src/dpxfile.c @@ -760,12 +760,36 @@ dpx_create_temp_file (void) tmp = NULL; } } -#else /* use tmpnam */ +#else /* use _tempnam or tmpnam */ { +# ifdef WIN32 +# define __TMPDIR "." + const char *_tmpd; + char *p; +# ifdef HAVE_GETENV + _tmpd = getenv ("TMPDIR"); + if (!_tmpd) + _tmpd = getenv ("TMP"); + if (!_tmpd) + _tmpd = getenv ("TEMP"); + if (!_tmpd) + _tmpd = __TMPDIR; +# else /* HAVE_GETENV */ + _tmpd = __TMPDIR; +# endif /* HAVE_GETENV */ + tmp = _tempnam (_tmpd, "dpxtmp."); + for (p = tmp; *p; p++) { + if (IS_KANJI (p)) + p++; + else if (*p == '\\') + *p = '/'; + } +# else /* WIN32 */ char *_tmpa = NEW(L_tmpnam + 1, char); tmp = tmpnam(_tmpa); if (!tmp) RELEASE(_tmpa); +# endif /* WIN32 */ } #endif /* MIKTEX */ diff --git a/Build/source/texk/xdvipdfmx/ChangeLog b/Build/source/texk/xdvipdfmx/ChangeLog index 7787524aed7..780a78c495b 100644 --- a/Build/source/texk/xdvipdfmx/ChangeLog +++ b/Build/source/texk/xdvipdfmx/ChangeLog @@ -1,3 +1,8 @@ +2013-03-24 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * src/dpxfile.c: Change dpx_create_temp_file() because tmpnam() + sometimes fails on Windows. + 2013-03-20 Khaled Hosny <khaledhosny@eglug.org> * spc_dvips.c (spc_handler_ps_tricks_pdef, spc_handler_ps_tricks_tdef, diff --git a/Build/source/texk/xdvipdfmx/src/dpxfile.c b/Build/source/texk/xdvipdfmx/src/dpxfile.c index 85833256b30..04c0027eb8c 100644 --- a/Build/source/texk/xdvipdfmx/src/dpxfile.c +++ b/Build/source/texk/xdvipdfmx/src/dpxfile.c @@ -780,12 +780,36 @@ dpx_create_temp_file (void) tmp = NULL; } } -#else /* use tmpnam */ +#else /* use _tempnam or tmpnam */ { +# ifdef WIN32 +# define __TMPDIR "." + const char *_tmpd; + char *p; +# ifdef HAVE_GETENV + _tmpd = getenv ("TMPDIR"); + if (!_tmpd) + _tmpd = getenv ("TMP"); + if (!_tmpd) + _tmpd = getenv ("TEMP"); + if (!_tmpd) + _tmpd = __TMPDIR; +# else /* HAVE_GETENV */ + _tmpd = __TMPDIR; +# endif /* HAVE_GETENV */ + tmp = _tempnam (_tmpd, "dpxtmp."); + for (p = tmp; *p; p++) { + if (IS_KANJI (p)) + p++; + else if (*p == '\\') + *p = '/'; + } +# else /* WIN32 */ char *_tmpa = NEW(L_tmpnam + 1, char); tmp = tmpnam(_tmpa); if (!tmp) RELEASE(_tmpa); +# endif /* WIN32 */ } #endif /* MIKTEX */ |