aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-06-26 23:49:02 +0000
committerNIIBE Yutaka <[email protected]>2019-06-26 23:49:02 +0000
commit70a5ea407c71cf094794d3d3375aab7fc2c4eca6 (patch)
tree120160961fb791eb92653f27b7bd87bb55482d64
parentestream: Use poll(2) when available. (diff)
downloadlibgpg-error-70a5ea407c71cf094794d3d3375aab7fc2c4eca6.tar.gz
libgpg-error-70a5ea407c71cf094794d3d3375aab7fc2c4eca6.zip
estream: Don't use variable length array.
* src/estream.c [HAVE_POLL_H] (_gpgrt_poll): No VLA. -- Fixes-commit: a21a7de8c2cf986235382e7e04805744f6df116e Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--src/estream.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/estream.c b/src/estream.c
index 668eb1b..33b9f4d 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -4787,7 +4787,7 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
int idx;
#ifndef HAVE_W32_SYSTEM
# ifdef HAVE_POLL_H
- struct pollfd poll_fds[nfds];
+ struct pollfd *poll_fds = NULL;
nfds_t poll_nfds;
# else
fd_set readfds, writefds, exceptfds;
@@ -4851,6 +4851,7 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
#else /*!HAVE_W32_SYSTEM*/
# ifdef HAVE_POLL_H
+ poll_fds = xtrymalloc (sizeof (*poll_fds)*nfds);
poll_nfds = 0;
for (item = fds, idx = 0; idx < nfds; item++, idx++)
{
@@ -5039,6 +5040,11 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout)
#endif /*!HAVE_W32_SYSTEM*/
leave:
+#ifndef HAVE_W32_SYSTEM
+# ifdef HAVE_POLL_H
+ xfree (poll_fds);
+# endif
+#endif
#ifdef ENABLE_TRACING
trace (("leave: count=%d", count));
if (count > 0)