texlive[49141] Build/source/texk/kpathsea: kpathsea: tex-make.c:

commits+preining at tug.org commits+preining at tug.org
Tue Nov 13 03:35:04 CET 2018


Revision: 49141
          http://tug.org/svn/texlive?view=revision&revision=49141
Author:   preining
Date:     2018-11-13 03:35:03 +0100 (Tue, 13 Nov 2018)
Log Message:
-----------
kpathsea: tex-make.c: check return value from dup (from Andreas)

Modified Paths:
--------------
    trunk/Build/source/texk/kpathsea/ChangeLog
    trunk/Build/source/texk/kpathsea/tex-make.c

Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog	2018-11-12 23:30:23 UTC (rev 49140)
+++ trunk/Build/source/texk/kpathsea/ChangeLog	2018-11-13 02:35:03 UTC (rev 49141)
@@ -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 at freefriends.org>
 
 	* kpsewhich.c (lookup): warn that --all is ignored with bitmap fonts.

Modified: trunk/Build/source/texk/kpathsea/tex-make.c
===================================================================
--- trunk/Build/source/texk/kpathsea/tex-make.c	2018-11-12 23:30:23 UTC (rev 49140)
+++ trunk/Build/source/texk/kpathsea/tex-make.c	2018-11-13 02:35:03 UTC (rev 49141)
@@ -318,13 +318,21 @@
       /* 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 */
@@ -331,7 +339,11 @@
       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);
       }



More information about the tex-live-commits mailing list