From 16a3fbd56b3dcfcbdd4190c07bf8634ebc5a5f78 Mon Sep 17 00:00:00 2001 From: Gerhard Muntingh Date: Tue, 14 Apr 2015 14:02:15 +0200 Subject: [PATCH] ceph-authtool: exit(1) when printing a non-existing key 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 --- src/tools/ceph_authtool.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/ceph_authtool.cc b/src/tools/ceph_authtool.cc index fd3f73fb5916..caf1f0ac55b3 100644 --- a/src/tools/ceph_authtool.cc +++ b/src/tools/ceph_authtool.cc @@ -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; } -- 2.47.3