From e3516caf9ec9db997b15c2bca467ecfcaa1235b4 Mon Sep 17 00:00:00 2001
From: Matthew McGill <mhollismcgill@gmail.com>
Date: Tue, 18 Dec 2018 18:53:42 +0000
Subject: [PATCH] Fixed silent failure issue

Former-commit-id: 32e722e86c572c6fffb1ed7f1a73866ce83660d1
---
 tools/selective_cfi/scfi_driver.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/selective_cfi/scfi_driver.cpp b/tools/selective_cfi/scfi_driver.cpp
index cd5374c12..0bd71b6d0 100644
--- a/tools/selective_cfi/scfi_driver.cpp
+++ b/tools/selective_cfi/scfi_driver.cpp
@@ -218,6 +218,7 @@ int main(int argc, char **argv)
 	cout<<"selective_cfi.exe started\n";
 
         bool one_success = false;
+	bool seen_failures = false;
         for(set<File_t*>::iterator it=pidp->GetFiles().begin();
             it!=pidp->GetFiles().end();
                 ++it)
@@ -245,15 +246,18 @@ int main(int argc, char **argv)
                         }
 			else
 			{
+				seen_failures = true;
 				cout<<"Skipping (no changes) "<<this_file->GetURL()<<endl;
 			}
                 }
                 catch (DatabaseError_t pnide)
                 {
+			seen_failures = true;
                         cerr << programName << ": Unexpected database error: " << pnide << "file url: " << this_file->GetURL() << endl;
                 }
                 catch (...)
                 {
+			seen_failures = true;
                         cerr << programName << ": Unexpected error file url: " << this_file->GetURL() << endl;
                 }
         } // end file iterator
@@ -265,6 +269,13 @@ int main(int argc, char **argv)
                 pqxx_interface.Commit();
 	}
 
-        return 0;
+	if(seen_failures)
+	{
+		return 1;
+	}
+	else
+	{
+        	return 0;
+	}
 }
 
-- 
GitLab