]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-fuse: check return value on system() invocation 4381/head
authorGreg Farnum <gfarnum@redhat.com>
Fri, 17 Apr 2015 01:03:59 +0000 (18:03 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 29 Apr 2015 22:45:42 +0000 (15:45 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/ceph_fuse.cc

index 76168503d594c71b8ec4debeae32b18d69e48fc2..b193dd31c6f18791b454f5d7599cf59c732b3401 100644 (file)
@@ -143,7 +143,20 @@ int main(int argc, const char **argv, const char *envp[]) {
          char buf[5050];
          string mountpoint = cfuse->get_mount_point();
          snprintf(buf, 5049, "fusermount -u -z %s", mountpoint.c_str());
-         system(buf);
+         int umount_r = system(buf);
+         if (umount_r) {
+           if (umount_r != -1) {
+             if (WIFEXITED(umount_r)) {
+               umount_r = WEXITSTATUS(umount_r);
+               cerr << "got error " << umount_r
+                    << " when unmounting Ceph on failed remount test!" << std::endl;
+             } else {
+               cerr << "attempt to umount on failed remount test failed (on a signal?)" << std::endl;
+             }
+           } else {
+             cerr << "system() invocation failed during remount test" << std::endl;
+           }
+         }
        }
        return reinterpret_cast<void*>(tr);
       }