From 1b62ee5cb4bb7b655b514d48453200cfbfd8a492 Mon Sep 17 00:00:00 2001 From: amitkuma Date: Mon, 31 Jul 2017 20:23:32 +0530 Subject: [PATCH] os: Argument cannot be negative 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/os/TestLFNIndex.cc b/src/test/os/TestLFNIndex.cc index fb7a0c9f97f..77919999117 100644 --- a/src/test/os/TestLFNIndex.cc +++ b/src/test/os/TestLFNIndex.cc @@ -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"); -- 2.39.5