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