Blob Blame History Raw
From 09cfc620e6d0135efff53cf01499937b0d496dc8 Mon Sep 17 00:00:00 2001
From: "Roderick W. Smith" <rodsmith@rodsbooks.com>
Date: Sat, 29 Mar 2014 00:45:59 -0400
Subject: [PATCH] Fixed bug that caused spurious "1" exit condition in gdisk.

---
 gdisk.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdisk.cc b/gdisk.cc
index b3c6240..5768869 100644
--- a/gdisk.cc
+++ b/gdisk.cc
@@ -15,6 +15,7 @@ int main(int argc, char* argv[]) {
    GPTDataTextUI theGPT;
    string device = "";
    UnicodeString uString;
+   int isError = 0;
 
    cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
 
@@ -47,16 +48,20 @@ int main(int argc, char* argv[]) {
             device = (string) argv[1];
          } else { // 3 arguments, but none is "-l"
             cerr << "Usage: " << argv[0] << " [-l] device_file\n";
+            isError = 1;
          } // if/elseif/else
          if (device != "") {
             theGPT.JustLooking();
             if (theGPT.LoadPartitions(device))
                theGPT.DisplayGPTData();
+            else
+               isError = 1;
          } // if
          break;
       default:
          cerr << "Usage: " << argv[0] << " [-l] device_file\n";
+         isError = 1;
          break;
    } // switch
-   return 1 ;
+   return (isError);
 } // main
-- 
2.17.2