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

John Ferlan jferlan at redhat.com
Thu Jul 11 12:34:02 UTC 2013


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




More information about the libvir-list mailing list