[PATCH v6 11/19] utils: Convert pollfd array to be allocated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <stefanb@xxxxxxxxxxxxx>
Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 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 5dee730826..8bbaced721 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -2124,6 +2124,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");
@@ -2155,9 +2156,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) {
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux