]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: test_c_headers: silence clang analyzer warnings
authorKefu Chai <kchai@redhat.com>
Thu, 13 Jul 2017 10:38:36 +0000 (18:38 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 13 Jul 2017 16:40:38 +0000 (00:40 +0800)
this silences clang analyzer's warnings like:

Value stored to 'ret' is never read

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/test_c_headers.c

index 0f41966acae2233f43fb0c2759dfe1fe18c1005a..fc83a82a2bcf91e2823e50f6fe73c897c3d77e75 100644 (file)
@@ -1,3 +1,7 @@
+// -*- mode:C++; tab-width:2; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=2 sw=2 smarttab
+
+#include <stdlib.h>
 #include "include/cephfs/libcephfs.h"
 #include "include/rados/librados.h"
 
 int main(int argc, char **argv)
 {
        int ret;
-       (void)ret; // squash unused warning
 
        /* librados.h */
        rados_t cluster;
        ret = rados_create(&cluster, NULL);
-
+       if (ret < 0) {
+               return EXIT_FAILURE;
+       }
        /* libcephfs.h */
        struct ceph_mount_info *cmount;
        ret = ceph_create(&cmount, NULL);
+       if (ret < 0) {
+               return EXIT_FAILURE;
+       }
 
        return 0;
 }