diff options
author | Azat Khuzhin <azat@libevent.org> | 2023-04-04 22:15:35 +0200 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2023-04-04 22:17:14 +0200 |
commit | f04d90b1219c392309671f3b477c80dea146a2fd (patch) | |
tree | 8c5c613bcf0e008e262c82019b9c7cc936129490 | |
parent | 1878232bd5b09bd43b65d48aa55db8de73dbc9cc (diff) | |
download | libevent-f04d90b1219c392309671f3b477c80dea146a2fd.tar.gz |
Fix building with -Wstack-protector due to VLA and fobid them
It is not a thankless task to fix such issues on and on, let's just
prohibit this cases, and our build with -Werror on CI will show new
issues from now on.
Fixes: #1434
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | test/regress_dns.c | 17 |
2 files changed, 8 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 19a1f1e1..7ce72bbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,6 +321,8 @@ if (${GNUC}) -Wno-unused-function -Wno-pragmas + + -Wvla ) if (${CLANG}) diff --git a/test/regress_dns.c b/test/regress_dns.c index ada8b33a..959f2f10 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -2509,16 +2509,11 @@ getaddrinfo_race_gotresolve_test(void *arg) struct evdns_server_port *dns_port = NULL; ev_uint16_t portnum = 0; char buf[64]; - int i; + size_t i; // Some stress is needed to yield inside getaddrinfo between resolve_ipv4 and resolve_ipv6 - int n_reqs = 16384; -#ifdef _SC_NPROCESSORS_ONLN - int n_threads = sysconf(_SC_NPROCESSORS_ONLN) + 1; -#else - int n_threads = 17; -#endif - THREAD_T thread[n_threads]; + size_t n_reqs = 16384; + THREAD_T threads[32]; struct timeval tv; (void)arg; @@ -2551,11 +2546,11 @@ getaddrinfo_race_gotresolve_test(void *arg) rp.stopping = 0; // Run resolver thread - THREAD_START(thread[0], race_base_run, &rp); + THREAD_START(threads[0], race_base_run, &rp); // Run busy-wait threads used to force yield this thread - for (i = 1; i < n_threads; i++) { + for (i = 1; i < ARRAY_SIZE(threads); i++) { rp.bw_threads++; - THREAD_START(thread[i], race_busywait_run, &rp); + THREAD_START(threads[i], race_busywait_run, &rp); } EVLOCK_LOCK(rp.lock, 0); |