diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 5526499b43..ea52acfbb8 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -494,7 +494,7 @@ virCommandMassCloseGetFDsDir(virBitmap *fds, return -1; } - ignore_value(virBitmapSetBit(fds, fd)); + virBitmapSetBitExpand(fds, fd); } if (rc < 0) @@ -539,9 +539,11 @@ virCommandMassCloseFrom(virCommand *cmd, * Therefore we can safely allocate memory here (and transitively call * opendir/readdir) without a deadlock. */ - if (openmax < 0) { - virReportSystemError(errno, "%s", _("sysconf(_SC_OPEN_MAX) failed")); - return -1; + if (openmax <= 0) { + /* Darwin defaults to 10240. Start with a generous value. + * virCommandMassCloseGetFDsDir() uses virBitmapSetBitExpand() anyways. + */ + openmax = 10240; } fds = virBitmapNew(openmax);