]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Checking fd for negative before closing 17190/head
authoramitkuma <amitkuma@redhat.com>
Wed, 23 Aug 2017 17:14:34 +0000 (22:44 +0530)
committeramitkuma <amitkuma@redhat.com>
Thu, 24 Aug 2017 17:18:02 +0000 (22:48 +0530)
Fixes the coverity issue:

** 1395317 Argument cannot be negative
161. negative_return_fn: Function open("bufferlist", 0) returns a
negative number.
162. var_assign: Assigning: signed variable fd = open.

Signed-off-by: Amit Kumar amitkuma@redhat.com
src/test/bufferlist.cc

index 53d66a036c8b96304639a57f169626ac65787d8d..4d454ab7ccd7e14b2d48c88ec866eaea21fc13f7 100644 (file)
@@ -219,6 +219,7 @@ TEST(Buffer, constructors) {
     snprintf(cmd, sizeof(cmd), "echo ABC > %s", FILENAME);
     EXPECT_EQ(0, ::system(cmd));
     int fd = ::open(FILENAME, O_RDONLY);
+    assert (fd >= 0);
     bufferptr ptr(buffer::create_zero_copy(zc_len, fd, NULL));
     history_alloc_bytes += zc_len;
     history_alloc_num++;