From: Greg Farnum Date: Fri, 17 Apr 2015 01:03:59 +0000 (-0700) Subject: ceph-fuse: check return value on system() invocation X-Git-Tag: v9.0.1~56^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=55414ae294c00d195c58d7a7e1499a58baa2f47b;p=ceph.git ceph-fuse: check return value on system() invocation Signed-off-by: Greg Farnum --- diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index 76168503d594c..b193dd31c6f18 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -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(tr); }