diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index ffd559e..f327a39 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -189,6 +189,7 @@ int main(int argc, char *argv[]) {
char *p;
GooString *ownerPW, *userPW;
Object info;
+ int exit_status = EXIT_SUCCESS;
// parse args
ok = parseArgs(argDesc, &argc, argv);
@@ -217,7 +218,8 @@ int main(int argc, char *argv[]) {
if (textEncName[0]) {
globalParams->setTextEncoding(textEncName);
if( !globalParams->getTextEncoding() ) {
- goto error;
+ exit_status = EXIT_FAILURE;
+ goto error;
}
}
@@ -252,6 +254,7 @@ int main(int argc, char *argv[]) {
delete ownerPW;
}
if (!doc->isOk()) {
+ exit_status = EXIT_FAILURE;
goto error;
}
@@ -259,6 +262,7 @@ int main(int argc, char *argv[]) {
if (!doc->okToCopy()) {
if (!noDrm) {
error(errNotAllowed, -1, "Copying of text from this document is not allowed.");
+ exit_status = EXIT_FAILURE;
goto error;
}
fprintf(stderr, "Document has copy-protection bit set.\n");
@@ -288,6 +292,7 @@ int main(int argc, char *argv[]) {
delete tmp;
} else if (fileName->cmp("fd://0") == 0) {
error(errCommandLine, -1, "You have to provide an output filename when reading form stdin.");
+ exit_status = EXIT_FAILURE;
goto error;
} else {
p = fileName->getCString() + fileName->getLength() - 4;
@@ -330,6 +335,7 @@ int main(int argc, char *argv[]) {
error(errCommandLine, -1,
"Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
firstPage, lastPage);
+ exit_status = EXIT_FAILURE;
goto error;
}
@@ -447,7 +453,7 @@ int main(int argc, char *argv[]) {
Object::memCheck(stderr);
gMemReport(stderr);
- return 0;
+ return exit_status;
}
static GooString* getInfoString(Dict *infoDict, const char *key) {