[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/7] testutils: Resolve Coverity issues



Recent changes uncovered a NEGATIVE_RETURNS in the return from sysconf()
when processing a for loop in virtTestCaptureProgramExecChild()
---
 tests/testutils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/testutils.c b/tests/testutils.c
index ec0fe52..2fdf7b8 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -281,6 +281,9 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
         goto cleanup;
 
     open_max = sysconf(_SC_OPEN_MAX);
+    if (open_max < 0)
+        goto cleanup;
+
     for (i = 0; i < open_max; i++) {
         if (i != stdinfd &&
             i != pipefd) {
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]