Commit fec75b44b4d5b0ee84c5bf98fee6139dceacfde3

Authored by Jay Berkenbilt
Committed by GitHub
2 parents c6a3d83f 94e63232

Merge pull request #1030 from m-holger/exit

Fix exit code when an input other than the primary input generates wa…
libqpdf/QPDFJob.cc
@@ -477,6 +477,12 @@ QPDFJob::createQPDF() @@ -477,6 +477,12 @@ QPDFJob::createQPDF()
477 } 477 }
478 handleUnderOverlay(pdf); 478 handleUnderOverlay(pdf);
479 handleTransformations(pdf); 479 handleTransformations(pdf);
  480 +
  481 + for (auto& foreign: page_heap) {
  482 + if (foreign->anyWarnings()) {
  483 + m->warnings = true;
  484 + }
  485 + }
480 return pdf_sp; 486 return pdf_sp;
481 } 487 }
482 488
qpdf/qtest/page-errors.test
@@ -22,7 +22,7 @@ $td->runtest("handle page no with contents", @@ -22,7 +22,7 @@ $td->runtest("handle page no with contents",
22 $td->NORMALIZE_NEWLINES); 22 $td->NORMALIZE_NEWLINES);
23 $td->runtest("handle page with missing MediaBox", 23 $td->runtest("handle page with missing MediaBox",
24 {$td->COMMAND => "qpdf --static-id --empty --pages page-no-content.pdf -- out.pdf"}, 24 {$td->COMMAND => "qpdf --static-id --empty --pages page-no-content.pdf -- out.pdf"},
25 - {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 0}, 25 + {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 3},
26 $td->NORMALIZE_NEWLINES); 26 $td->NORMALIZE_NEWLINES);
27 $td->runtest("check output", 27 $td->runtest("check output",
28 {$td->FILE => "out.pdf"}, 28 {$td->FILE => "out.pdf"},
qpdf/qtest/qpdf/page-missing-mediabox.out
1 WARNING: page-no-content.pdf, object 4 0 at offset 288: kid 1 (from 0) MediaBox is undefined; setting to letter / ANSI A 1 WARNING: page-no-content.pdf, object 4 0 at offset 288: kid 1 (from 0) MediaBox is undefined; setting to letter / ANSI A
  2 +qpdf: operation succeeded with warnings; resulting file may have some problems