diffconfig: Gracefully exit if the default config files are not present
[firefly-linux-kernel-4.4.55.git] / scripts / diffconfig
index b91f3e34d44d5d39907b8bbef3de4fb6f37fbb69..0ee65839f7aa00ee931dc2c0ebf2edb665654ca4 100755 (executable)
@@ -94,8 +94,13 @@ def main():
         configa_filename = sys.argv[1]
         configb_filename = sys.argv[2]
 
-    a = readconfig(file(configa_filename))
-    b = readconfig(file(configb_filename))
+    try:
+        a = readconfig(file(configa_filename))
+        b = readconfig(file(configb_filename))
+    except (IOError):
+        e = sys.exc_info()[1]
+        print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
+        usage()
 
     # print items in a but not b (accumulate, sort and print)
     old = []