diff --git a/src/util/util.c b/src/util/util.c index d6fa81b4af..197c57126c 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -570,7 +570,7 @@ __virExec(const char *const*argv, i != null && i != childout && i != childerr && - (!keepfd || (i < FD_SETSIZE && !FD_ISSET(i, keepfd)))) { + (!keepfd || i >= FD_SETSIZE || !FD_ISSET(i, keepfd))) { tmpfd = i; VIR_FORCE_CLOSE(tmpfd); }