summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/kpathsea/ChangeLog4
-rw-r--r--Build/source/texk/kpathsea/tex-make.c18
2 files changed, 19 insertions, 3 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 6341326931e..ddfa0f799e4 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-12 Andreas Scherer <https://ascherer.github.io>
+
+ * tex-make.c (maketex): check return value from dup(2).
+
2018-07-02 Karl Berry <karl@freefriends.org>
* kpsewhich.c (lookup): warn that --all is ignored with bitmap fonts.
diff --git a/Build/source/texk/kpathsea/tex-make.c b/Build/source/texk/kpathsea/tex-make.c
index 95851fdd561..629857a3346 100644
--- a/Build/source/texk/kpathsea/tex-make.c
+++ b/Build/source/texk/kpathsea/tex-make.c
@@ -318,20 +318,32 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
/* stdin -- the child will not receive input from this */
if (childin != 0) {
close(0);
- dup(childin);
+ if (dup(childin) != 0) {
+ perror("kpathsea: dup(2) failed for stdin");
+ close(childin);
+ _exit(1);
+ }
close(childin);
}
/* stdout -- the output of the child's action */
if (childout[1] != 1) {
close(1);
- dup(childout[1]);
+ if (dup(childout[1]) != 1) {
+ perror("kpathsea: dup(2) failed for stdout");
+ close(childout[1]);
+ _exit(1);
+ }
close(childout[1]);
}
/* stderr -- use /dev/null if we discard errors */
if (childerr != 2) {
if (kpse->make_tex_discard_errors) {
close(2);
- dup(childerr);
+ if (dup(childerr) != 2) {
+ perror("kpathsea: dup(2) failed for stderr");
+ close(childerr);
+ _exit(1);
+ }
}
close(childerr);
}