diff options
Diffstat (limited to 'Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-02-exec_spawn')
-rw-r--r-- | Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-02-exec_spawn | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-02-exec_spawn b/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-02-exec_spawn new file mode 100644 index 00000000000..e49c44b0ef4 --- /dev/null +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-02-exec_spawn @@ -0,0 +1,129 @@ +diff -ur dvipdfmx-20110311.orig/src/dpxfile.c dvipdfmx-20110311/src/dpxfile.c +--- dvipdfmx-20110311.orig/src/dpxfile.c 2011-03-11 04:10:51.000000000 +0100 ++++ dvipdfmx-20110311/src/dpxfile.c 2011-06-06 09:50:11.000000000 +0200 +@@ -154,10 +154,14 @@ + { + char **cmdv, **qv; + char *p, *pp; +- char buf[512]; +- int i, ret; ++ char buf[1024]; ++ int i, ret = -1; + +- if (!cmd || !*cmd) ++ if (!cmd) ++ return -1; ++ while (*cmd == ' ' || *cmd == '\t') ++ cmd++; ++ if (*cmd == '\0') + return -1; + i = 0; + p = cmd; +@@ -166,19 +170,16 @@ + i++; + p++; + } +- cmdv = (char **) xmalloc (sizeof (char *) * (i+2)); ++ cmdv = xcalloc (i + 2, sizeof (char *)); + p = cmd; + qv = cmdv; +- while (*p == ' ' || *p == '\t') +- p++; + while (*p) { + pp = buf; + if (*p == '"') { + p++; + while (*p != '"') { + if (*p == '\0') { +- free (cmdv); +- return -1; ++ goto done; + } + *pp++ = *p++; + } +@@ -187,40 +188,41 @@ + p++; + while (*p != '\'') { + if (*p == '\0') { +- free (cmdv); +- return -1; ++ goto done; + } + *pp++ = *p++; + } + p++; + } else { +- while (*p != ' ' && *p != '\t' && *p) +-#ifdef WIN32 ++ while (*p != ' ' && *p != '\t' && *p) { + if (*p == '\'') { +- *pp++ = '\"'; ++ p++; ++ while (*p != '\'') { ++ if (*p == '\0') { ++ goto done; ++ } ++ *pp++ = *p++; ++ } + p++; + } else { + *pp++ = *p++; + } +-#else +- *pp++ = *p++; +-#endif ++ } + } + *pp = '\0'; +- if ((pp = strchr (buf, ' ')) || (pp = strchr (buf, '\t'))) { + #ifdef WIN32 ++ if (strchr (buf, ' ') || strchr (buf, '\t')) + *qv = concat3 ("\"", buf, "\""); +-#else +- *qv = concat3 ("'", buf, "'"); ++ else + #endif +- } else { +- *qv = concat (buf, ""); +- } ++ *qv = xstrdup (buf); ++/* ++ fprintf(stderr,"\n%s", *qv); ++*/ + while (*p == ' ' || *p == '\t') + p++; + qv++; + } +- *qv = NULL; + #ifdef WIN32 + ret = spawnvp (_P_WAIT, *cmdv, (const char* const*) cmdv); + #else +@@ -229,7 +231,7 @@ + ret = -1; + else if (i == 0) { + if (execvp (*cmdv, cmdv)) +- ret = -1; ++ _exit (-1); + } else { + if (wait (&ret) == i) { + ret = (WIFEXITED (ret) ? WEXITSTATUS (ret) : -1); +@@ -238,14 +240,13 @@ + } + } + #endif ++done: + qv = cmdv; +- if (qv) { +- while (*qv) { +- free (*qv); +- qv++; +- } +- free (cmdv); ++ while (*qv) { ++ free (*qv); ++ qv++; + } ++ free (cmdv); + return ret; + } + |