From 55414ae294c00d195c58d7a7e1499a58baa2f47b Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 16 Apr 2015 18:03:59 -0700 Subject: [PATCH] ceph-fuse: check return value on system() invocation Signed-off-by: Greg Farnum --- src/ceph_fuse.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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); } -- 2.39.5