]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-authtool: exit(1) when printing a non-existing key 4358/head
authorGerhard Muntingh <gerhard@warpnet.nl>
Tue, 14 Apr 2015 12:02:15 +0000 (14:02 +0200)
committerGerhard Muntingh <gerhard@qux.nl>
Thu, 16 Apr 2015 14:42:13 +0000 (16:42 +0200)
When printing a non-existing key, ceph-authtool exits with a success
value:

[root@ip-172-31-3-178 ~]# ceph-authtool /etc/ceph/ceph.mon.keyring -p -n
client.doesntexist ; echo $?
entity client.doesntexist not found
0

Expected result: 1

Signed-off-by: Gerhard Muntingh <gerhard@qux.nl>
src/tools/ceph_authtool.cc

index fd3f73fb5916625a30f8becd1a269596c69d6351..caf1f0ac55b360571c4c0401bd00dfd69e5d08da 100644 (file)
@@ -264,6 +264,7 @@ int main(int argc, const char **argv)
         cout << key << std::endl;
       } else {
         cerr << "entity " << ename << " not found" << std::endl;
+        exit(1);
       }
     }
   
@@ -274,6 +275,7 @@ int main(int argc, const char **argv)
       r = bl.write_file(fn.c_str(), 0600);
       if (r < 0) {
         cerr << "could not write " << fn << std::endl;
+        exit(1);
       }
       //cout << "wrote " << bl.length() << " bytes to " << fn << std::endl;
     }