From 99d4f0857a619d349616b13a9a3e31b59c842d46 Mon Sep 17 00:00:00 2001 From: amitkuma Date: Mon, 28 Aug 2017 21:13:37 +0530 Subject: [PATCH] test: assert check for negetive returns 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 --- src/test/objectstore/chain_xattr.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/objectstore/chain_xattr.cc b/src/test/objectstore/chain_xattr.cc index a30c57c8403..c0cb31c5e97 100644 --- a/src/test/objectstore/chain_xattr.cc +++ b/src/test/objectstore/chain_xattr.cc @@ -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); -- 2.39.5