summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-10-03 11:07:03 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-10-03 11:07:03 +0000
commit0a0816e7a18071b30bb6cc36dc3f56a713a3e9bd (patch)
treefcc7a7fcb2dea531694c65bed8fd9a7f34f94961
parent3c02a9fad304101bcfce495d881c9590f6998943 (diff)
dviljk: Avoid seg fault for missing WINDIR
git-svn-id: svn://tug.org/texlive/trunk@27871 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dviljk/ChangeLog4
-rw-r--r--Build/source/texk/dviljk/dvi2xx.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog
index c6a8a9c74cf..a70c472f153 100644
--- a/Build/source/texk/dviljk/ChangeLog
+++ b/Build/source/texk/dviljk/ChangeLog
@@ -1,3 +1,7 @@
+2012-10-03 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * dvi2xx.c [WIN32]: Avoid segmentation fault for missing WINDIR.
+
2012-10-02 Peter Breitenlohner <peb@mppmu.mpg.de>
* dvi2xx.c [WIN32]: Drop is_dir() and handle tmp_dir differently
diff --git a/Build/source/texk/dviljk/dvi2xx.c b/Build/source/texk/dviljk/dvi2xx.c
index b58e85ab0a7..fcc11370791 100644
--- a/Build/source/texk/dviljk/dvi2xx.c
+++ b/Build/source/texk/dviljk/dvi2xx.c
@@ -4021,16 +4021,19 @@ void DoSpecial(char *str, int n)
if ( tmp_dir[0] == '\0' ) {
const char * base_dir, * base_base;
#ifdef WIN32
- char *def_tmp = concat (getenv ("WINDIR"), "/Temp");
+ char *def_tmp;
+ if ( (base_dir = getenv("WINDIR")) == NULL )
+ base_dir = "";
+ def_tmp = concat (base_dir, "/Temp");
if ( (base_dir = getenv("TMPDIR")) == NULL &&
(base_dir = getenv("TMP")) == NULL &&
- (base_dir = getenv("TEMP")) == NULL ) {
+ (base_dir = getenv("TEMP")) == NULL )
#else
# define def_tmp "/tmp"
- if ( (base_dir = getenv("TMPDIR")) == NULL ) {
+ if ( (base_dir = getenv("TMPDIR")) == NULL )
#endif
base_dir = def_tmp;
- } else if ( strlen(base_dir) > STRSIZE - sizeof("/dviljkXXXXXX/include.pcl") ) {
+ else if ( strlen(base_dir) > STRSIZE - sizeof("/dviljkXXXXXX/include.pcl") ) {
Warning ("TMPDIR %s is too long, using %s instead", base_dir, def_tmp);
base_dir = def_tmp;
}