summaryrefslogtreecommitdiff
path: root/Build/source/texk/lcdf-typetools
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-09-21 13:05:46 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-09-21 13:05:46 +0000
commit797498a4988dd083cacef08d09e646f0b3c1a51f (patch)
tree346bca56c902575939ef72002eb6c7a5925b44c4 /Build/source/texk/lcdf-typetools
parent243a58c14b4ac53cd02e7aa11e87a1d0bcd59ca0 (diff)
lcdf-typetools (otftotfm): Avoid that WIN32 puts temporary files
into the root directory resulting in 'Permission denied' git-svn-id: svn://tug.org/texlive/trunk@27760 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/lcdf-typetools')
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/ChangeLog5
-rw-r--r--Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/patch-31-WIN3226
-rw-r--r--Build/source/texk/lcdf-typetools/otftotfm/util.cc13
3 files changed, 44 insertions, 0 deletions
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/ChangeLog b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/ChangeLog
index 0e1b81f28c3..329dfc8515c 100644
--- a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/ChangeLog
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-21 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * patch-31-WIN32 (new): Avoid that WIN32 puts temporary files
+ into the root directory resulting in 'Permission denied'.
+
2012-08-16 Peter Breitenlohner <peb@mppmu.mpg.de>
* patch-06-enc_format (new): Bug fix.
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/patch-31-WIN32 b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/patch-31-WIN32
new file mode 100644
index 00000000000..1a81967f779
--- /dev/null
+++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.94-PATCHES/patch-31-WIN32
@@ -0,0 +1,26 @@
+diff -ur -x Makefile.in -x aclocal.m4 -x autoconf.h.in -x configure lcdf-typetools-2.94.orig/otftotfm/util.cc lcdf-typetools-2.94/otftotfm/util.cc
+--- lcdf-typetools-2.94.orig/otftotfm/util.cc 2012-08-11 17:42:50.000000000 +0200
++++ lcdf-typetools-2.94/otftotfm/util.cc 2012-09-21 14:21:28.000000000 +0200
+@@ -184,9 +184,22 @@
+ errh->error("temporary file %<%s%>: %s", filename.c_str(), strerror(errno));
+ return fd;
+ #else // !HAVE_MKSTEMP
++#ifdef WIN32
++ const char *tmp_dir = getenv("TEMP");
++ if (!tmp_dir)
++ tmp_dir = ".";
++#endif
+ for (int tries = 0; tries < 5; tries++) {
+ if (!(filename = tmpnam(0)))
+ return errh->error("cannot create temporary file");
++#ifdef WIN32
++ char *tmpp;
++ if ((tmpp = strrchr(filename.c_str(), '/')))
++ filename = ++tmpp;
++ if ((tmpp = strrchr(filename.c_str(), '\\')))
++ filename = ++tmpp;
++ filename = String(tmp_dir) + "\\" + filename;
++#endif
+ # ifdef O_EXCL
+ int fd = ::open(filename.c_str(), O_RDWR | O_CREAT | O_EXCL | O_TRUNC, 0600);
+ # else
diff --git a/Build/source/texk/lcdf-typetools/otftotfm/util.cc b/Build/source/texk/lcdf-typetools/otftotfm/util.cc
index dc2024f6c50..6ae7a2ffcbf 100644
--- a/Build/source/texk/lcdf-typetools/otftotfm/util.cc
+++ b/Build/source/texk/lcdf-typetools/otftotfm/util.cc
@@ -184,9 +184,22 @@ temporary_file(String &filename, ErrorHandler *errh)
errh->error("temporary file %<%s%>: %s", filename.c_str(), strerror(errno));
return fd;
#else // !HAVE_MKSTEMP
+#ifdef WIN32
+ const char *tmp_dir = getenv("TEMP");
+ if (!tmp_dir)
+ tmp_dir = ".";
+#endif
for (int tries = 0; tries < 5; tries++) {
if (!(filename = tmpnam(0)))
return errh->error("cannot create temporary file");
+#ifdef WIN32
+ char *tmpp;
+ if ((tmpp = strrchr(filename.c_str(), '/')))
+ filename = ++tmpp;
+ if ((tmpp = strrchr(filename.c_str(), '\\')))
+ filename = ++tmpp;
+ filename = String(tmp_dir) + "\\" + filename;
+#endif
# ifdef O_EXCL
int fd = ::open(filename.c_str(), O_RDWR | O_CREAT | O_EXCL | O_TRUNC, 0600);
# else