]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-nbd: correctly set exit status if map command failed
authorMykola Golub <mgolub@mirantis.com>
Wed, 13 Jan 2016 10:47:58 +0000 (12:47 +0200)
committerMykola Golub <mgolub@mirantis.com>
Wed, 13 Jan 2016 11:07:42 +0000 (13:07 +0200)
- parent_wait() returns child exit status so test for "!= 0";
- do_map() is expected to return a negative value on failure.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/tools/rbd_nbd/rbd-nbd.cc

index 04a935aa97236b96c6365c33a49cd2cdff44e1a5..41fcfc25e6b1d8f8162baceae66591000afb2ded 100644 (file)
@@ -486,15 +486,15 @@ static int do_map()
 
   if (global_init_prefork(g_ceph_context) >= 0) {
     std::string err;
-    if (forker.prefork(err) < 0) {
+    r = forker.prefork(err);
+    if (r < 0) {
       cerr << err << std::endl;
-      return EXIT_FAILURE;
+      return r;
     }
 
     if (forker.is_parent()) {
-      if (forker.parent_wait(err) < 0) {
-       cerr << err << std::endl;
-       return EXIT_FAILURE;
+      if (forker.parent_wait(err) != 0) {
+       return -ENXIO;
       }
       return 0;
     }