提交 8d2d8a6b 编写于 作者: S Stefan Berger 提交者: Daniel P. Berrangé

utils: Convert pollfd array to be allocated

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: NStefan Berger <stefanb@linux.ibm.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 149eda40
...@@ -2142,6 +2142,7 @@ virCommandProcessIO(virCommandPtr cmd) ...@@ -2142,6 +2142,7 @@ virCommandProcessIO(virCommandPtr cmd)
size_t inlen = 0, outlen = 0, errlen = 0; size_t inlen = 0, outlen = 0, errlen = 0;
size_t inoff = 0; size_t inoff = 0;
int ret = 0; int ret = 0;
VIR_AUTOFREE(struct pollfd *) fds = NULL;
if (dryRunBuffer || dryRunCallback) { if (dryRunBuffer || dryRunCallback) {
VIR_DEBUG("Dry run requested, skipping I/O processing"); VIR_DEBUG("Dry run requested, skipping I/O processing");
...@@ -2173,9 +2174,11 @@ virCommandProcessIO(virCommandPtr cmd) ...@@ -2173,9 +2174,11 @@ virCommandProcessIO(virCommandPtr cmd)
goto cleanup; goto cleanup;
ret = -1; ret = -1;
if (VIR_ALLOC_N(fds, 3) < 0)
goto cleanup;
for (;;) { for (;;) {
size_t i; size_t i;
struct pollfd fds[3];
int nfds = 0; int nfds = 0;
if (cmd->inpipe != -1) { if (cmd->inpipe != -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册