summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTakuji Tanaka <ttk@t-lab.opal.ne.jp>2021-06-13 13:01:05 +0000
committerTakuji Tanaka <ttk@t-lab.opal.ne.jp>2021-06-13 13:01:05 +0000
commitf32363dfbfc8443caae988c2d57b85b8a535c505 (patch)
tree05992e7f22c2fb842e3680b46552e070e3d4b7c4 /Build
parent1ea6ce62b6cea8d2b60116445ac2393790507d7f (diff)
upmendex: same bug fixes as for mendex
git-svn-id: svn://tug.org/texlive/trunk@59572 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/upmendex/ChangeLog8
-rw-r--r--Build/source/texk/upmendex/fwrite.c9
-rw-r--r--Build/source/texk/upmendex/pageread.c2
-rw-r--r--Build/source/texk/upmendex/styfile.c2
4 files changed, 15 insertions, 6 deletions
diff --git a/Build/source/texk/upmendex/ChangeLog b/Build/source/texk/upmendex/ChangeLog
index 8db4eb24514..e277034e4c0 100644
--- a/Build/source/texk/upmendex/ChangeLog
+++ b/Build/source/texk/upmendex/ChangeLog
@@ -1,3 +1,11 @@
+2021-06-13 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ Same fixes as for mendex.
+ * fwrite.c:
+ Avoid segmentation fault for unwritable fopen.
+ * pageread.c, styfile.c: Exit code 255 for non-existent
+ style/log file.
+
2021-06-06 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* version 0.57 Beta version.
diff --git a/Build/source/texk/upmendex/fwrite.c b/Build/source/texk/upmendex/fwrite.c
index 5308c69109f..7224fc7a88d 100644
--- a/Build/source/texk/upmendex/fwrite.c
+++ b/Build/source/texk/upmendex/fwrite.c
@@ -154,11 +154,12 @@ void indwrite(char *filename, struct index *ind, int pagenum)
char lbuff[BUFFERLEN],obuff[BUFFERLEN];
UChar datama[256],initial[INITIALLENGTH],initial_prev[INITIALLENGTH];
int chset,chset_prev;
- FILE *fp;
+ FILE *fp=NULL;
UErrorCode perr;
- if (filename && kpse_out_name_ok(filename)) fp=fopen(filename,"wb");
- else {
+ if (filename && kpse_out_name_ok(filename))
+ fp=fopen(filename,"wb");
+ if (fp == NULL) {
fp=stdout;
#ifdef WIN32
setmode(fileno(fp), _O_BINARY);
@@ -402,7 +403,7 @@ void indwrite(char *filename, struct index *ind, int pagenum)
}
fputs(postamble,fp);
- if (filename) fclose(fp);
+ if (fp!=stdout) fclose(fp);
}
/* write page block */
diff --git a/Build/source/texk/upmendex/pageread.c b/Build/source/texk/upmendex/pageread.c
index b77fb2931d9..ac72af48b86 100644
--- a/Build/source/texk/upmendex/pageread.c
+++ b/Build/source/texk/upmendex/pageread.c
@@ -39,7 +39,7 @@ int lastpage(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"No log file, %s.\n",logfile);
- exit(0);
+ exit(255);
}
while (1) {
diff --git a/Build/source/texk/upmendex/styfile.c b/Build/source/texk/upmendex/styfile.c
index b6e35ea3324..c0d583c2b71 100644
--- a/Build/source/texk/upmendex/styfile.c
+++ b/Build/source/texk/upmendex/styfile.c
@@ -47,7 +47,7 @@ void styread(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"%s does not exist.\n",filename);
- exit(0);
+ exit(255);
}
verb_printf(efp,"Scanning style file %s.",filename);