mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
testutils: Resolve Coverity issues
Recent changes uncovered a NEGATIVE_RETURNS in the return from sysconf() when processing a for loop in virtTestCaptureProgramExecChild() in testutils.c Code review uncovered 3 other code paths with the same condition that weren't found by Covirity, so fixed those as well.
This commit is contained in:
@@ -58,6 +58,7 @@ static int envsort(const void *a, const void *b) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
size_t i, n;
|
||||
int open_max;
|
||||
char **origenv;
|
||||
char **newenv;
|
||||
char *cwd;
|
||||
@@ -96,7 +97,10 @@ int main(int argc, char **argv) {
|
||||
fprintf(log, "ENV:%s\n", newenv[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) {
|
||||
open_max = sysconf(_SC_OPEN_MAX);
|
||||
if (open_max < 0)
|
||||
return EXIT_FAILURE;
|
||||
for (i = 0; i < open_max; i++) {
|
||||
int f;
|
||||
int closed;
|
||||
if (i == fileno(log))
|
||||
|
||||
Reference in New Issue
Block a user