0ddb34
From 09cfc620e6d0135efff53cf01499937b0d496dc8 Mon Sep 17 00:00:00 2001
0ddb34
From: "Roderick W. Smith" <rodsmith@rodsbooks.com>
0ddb34
Date: Sat, 29 Mar 2014 00:45:59 -0400
0ddb34
Subject: [PATCH] Fixed bug that caused spurious "1" exit condition in gdisk.
0ddb34
0ddb34
---
0ddb34
 gdisk.cc | 7 ++++++-
0ddb34
 1 file changed, 6 insertions(+), 1 deletion(-)
0ddb34
0ddb34
diff --git a/gdisk.cc b/gdisk.cc
0ddb34
index b3c6240..5768869 100644
0ddb34
--- a/gdisk.cc
0ddb34
+++ b/gdisk.cc
0ddb34
@@ -15,6 +15,7 @@ int main(int argc, char* argv[]) {
0ddb34
    GPTDataTextUI theGPT;
0ddb34
    string device = "";
0ddb34
    UnicodeString uString;
0ddb34
+   int isError = 0;
0ddb34
 
0ddb34
    cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
0ddb34
 
0ddb34
@@ -47,16 +48,20 @@ int main(int argc, char* argv[]) {
0ddb34
             device = (string) argv[1];
0ddb34
          } else { // 3 arguments, but none is "-l"
0ddb34
             cerr << "Usage: " << argv[0] << " [-l] device_file\n";
0ddb34
+            isError = 1;
0ddb34
          } // if/elseif/else
0ddb34
          if (device != "") {
0ddb34
             theGPT.JustLooking();
0ddb34
             if (theGPT.LoadPartitions(device))
0ddb34
                theGPT.DisplayGPTData();
0ddb34
+            else
0ddb34
+               isError = 1;
0ddb34
          } // if
0ddb34
          break;
0ddb34
       default:
0ddb34
          cerr << "Usage: " << argv[0] << " [-l] device_file\n";
0ddb34
+         isError = 1;
0ddb34
          break;
0ddb34
    } // switch
0ddb34
-   return 1 ;
0ddb34
+   return (isError);
0ddb34
 } // main
0ddb34
-- 
0ddb34
2.17.2
0ddb34