Skip to content

Commit 55c8a63

Browse files
committed
Make sure iinfo return code indicates failures for files that can't be opened (AcademySoftwareFoundation#2511)
Closes AcademySoftwareFoundation#2506
1 parent 0d47dbf commit 55c8a63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/iinfo/iinfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ main(int argc, const char* argv[])
670670
longestname = std::max(longestname, s.length());
671671
longestname = std::min(longestname, (size_t)40);
672672

673+
int returncode = EXIT_SUCCESS;
673674
long long totalsize = 0;
674675
for (auto&& s : filenames) {
675676
auto in = ImageInput::open(s);
@@ -678,6 +679,7 @@ main(int argc, const char* argv[])
678679
if (err.empty())
679680
err = Strutil::sprintf("Could not open \"%s\"", s);
680681
std::cerr << "iinfo ERROR: " << err << "\n";
682+
returncode = EXIT_FAILURE;
681683
continue;
682684
}
683685
ImageSpec spec = in->spec();
@@ -692,5 +694,5 @@ main(int argc, const char* argv[])
692694
printf("Total size: %.2f MB\n", t);
693695
}
694696

695-
return 0;
697+
return returncode;
696698
}

0 commit comments

Comments
 (0)