]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os: Argument cannot be negative
authoramitkuma <amitkuma@redhat.com>
Mon, 31 Jul 2017 14:53:32 +0000 (20:23 +0530)
committeramitkuma <amitkuma@redhat.com>
Tue, 1 Aug 2017 14:43:06 +0000 (20:13 +0530)
Fixed:

** CID 1395347 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
3. negative_returns: fd is passed to a parameter that cannot be negative

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

index fb7a0c9f97f1779efd8e1e5affd9d520a8083e52..77919999117f49e7c3a7d165ff9c3f36f0bb0572 100644 (file)
@@ -452,6 +452,10 @@ TEST_F(TestLFNIndex, get_mangled_name) {
 
 int main(int argc, char **argv) {
   int fd = ::creat("detect", 0600);
+  if (fd < 0){
+    cerr << "failed to create file detect" << std::endl;
+    return EXIT_FAILURE;
+  }
   int ret = chain_fsetxattr(fd, "user.test", "A", 1);
   ::close(fd);
   ::unlink("detect");