From 8d2d8a6bea1174a35ee727b08153b18d99cdd65c Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 25 Jul 2019 14:22:07 -0400 Subject: [PATCH] utils: Convert pollfd array to be allocated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert the struct pollfd *fds to be allocated rather than residing on the stack. This prepares it for the next patch where the size of the array of fds becomes dynamic. Signed-off-by: Stefan Berger Reviewed-by: Daniel P. Berrangé --- src/util/vircommand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index c42e14bc4d..94b2ebc8aa 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2142,6 +2142,7 @@ virCommandProcessIO(virCommandPtr cmd) size_t inlen = 0, outlen = 0, errlen = 0; size_t inoff = 0; int ret = 0; + VIR_AUTOFREE(struct pollfd *) fds = NULL; if (dryRunBuffer || dryRunCallback) { VIR_DEBUG("Dry run requested, skipping I/O processing"); @@ -2173,9 +2174,11 @@ virCommandProcessIO(virCommandPtr cmd) goto cleanup; ret = -1; + if (VIR_ALLOC_N(fds, 3) < 0) + goto cleanup; + for (;;) { size_t i; - struct pollfd fds[3]; int nfds = 0; if (cmd->inpipe != -1) { -- GitLab