summaryrefslogtreecommitdiff
path: root/Build/source/texk/ptexenc/ptexenc.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-12-13 11:20:26 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-12-13 11:20:26 +0000
commit98b38818d5618fce1e1cf6e95a924e206249eb42 (patch)
treefe9f1689584277105855987d376ca8692490bfdb /Build/source/texk/ptexenc/ptexenc.c
parent98b3e920b0a94a24517b8ccede04d1a9a3cc9c3f (diff)
kpathsea: Resolve remaining const related problems
web2c, ptexenc: Adapt git-svn-id: svn://tug.org/texlive/trunk@28521 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ptexenc/ptexenc.c')
-rw-r--r--Build/source/texk/ptexenc/ptexenc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c
index ed178a77b53..4c1d6acc11d 100644
--- a/Build/source/texk/ptexenc/ptexenc.c
+++ b/Build/source/texk/ptexenc/ptexenc.c
@@ -817,6 +817,7 @@ static void nkf_check(void)
/* 'mode' must be read */
FILE *nkf_open(const char *path, const char *mode) {
char buff[PATH_MAX * 2 + 20]; /* 20 is enough gaps */
+ char *name;
FILE *fp;
if (in_filter == NULL) {
@@ -830,10 +831,14 @@ FILE *nkf_open(const char *path, const char *mode) {
}
if (in_filter[0] == '\0') return fopen(path, mode);
- path = kpse_readable_file(path);
- if (path == NULL) return NULL; /* can't read */
+ name = xstrdup(path);
+ if (kpse_readable_file(name) == NULL) {
+ free(name);
+ return NULL; /* can't read */
+ }
sprintf(buff, "%.*s < '%.*s'", PATH_MAX, in_filter, PATH_MAX, path);
+ free(name);
/* fprintf(stderr, "\n`%s`", buff); */
fp = popen(buff , "r");
if (piped_num < NOFILE) piped_fp[piped_num++] = fp;