commit 8968dccfb6f38b47fec287a889a2799f35a38ba8
parent e3e54b4f62f02b7c787ecaf064dba17ee1f1a9ca
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 15 Oct 2017 21:29:17 +0200
check return values from dup2()
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/plugins/pdf_extractor.c b/src/plugins/pdf_extractor.c
@@ -178,8 +178,9 @@ EXTRACTOR_pdf_extract_method (struct EXTRACTOR_ExtractContext *ec)
/* am child, exec 'pdfinfo' */
close (0);
close (1);
- dup2 (in[0], 0);
- dup2 (out[1], 1);
+ if ( (-1 == dup2 (in[0], 0)) ||
+ (-1 == dup2 (out[1], 1)) )
+ exit (1);
close (in[0]);
close (in[1]);
close (out[0]);