]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test: assert check for negetive returns
authoramitkuma <amitkuma@redhat.com>
Mon, 28 Aug 2017 15:43:37 +0000 (21:13 +0530)
committeramitkuma <amitkuma@redhat.com>
Mon, 28 Aug 2017 15:43:37 +0000 (21:13 +0530)
Fixes the coverity issue:

** 1395371 Argument cannot be negative
1. negative_return_fn: Function open(file, 578, 448) returs a negative number.
2. var_assign: Assigning: signed variable fd = open

** 1395427 Argument cannot be negative
1. negative_return_fn: Function open(file, 578, 448) returns a negative number.
2. var_assign: Assigning: signed variable fd = open

Signed-off-by: Amit Kumar <amitkuma@redhat.com>
src/test/objectstore/chain_xattr.cc

index a30c57c84030a7172fbb0b9d7f889babc33215b5..c0cb31c5e979ceb99cca702ca83e4bdc46bb34e5 100644 (file)
@@ -348,6 +348,7 @@ TEST(chain_xattr, fskip_chain_cleanup_and_ensure_single_attr)
   const char *file = FILENAME;
   ::unlink(file);
   int fd = ::open(file, O_CREAT|O_RDWR|O_TRUNC, 0700);
+  assert(fd >= 0);
 
   std::size_t existing_xattrs = get_xattrs(fd).size();
   char buf[800];
@@ -392,6 +393,7 @@ TEST(chain_xattr, skip_chain_cleanup_and_ensure_single_attr)
   const char *file = FILENAME;
   ::unlink(file);
   int fd = ::open(file, O_CREAT|O_RDWR|O_TRUNC, 0700);
+  assert(fd >= 0);
   std::size_t existing_xattrs = get_xattrs(fd).size();
   ::close(fd);