1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
From ac84787559f95f717cecb444bab6c4c5f7293f3e Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 16 Jan 2019 14:28:37 +0000
Subject: [PATCH] MDEV-18269 - fix off-by-one bug in unittest
Fix the off-by-one overflow which was introduced with commit
b0fd06a6f2721 (MDEV-15670 - unit.my_atomic failed in buildbot with
Signal 11 thrown)
---
unittest/mysys/thr_template.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/unittest/mysys/thr_template.c b/unittest/mysys/thr_template.c
index 3a57ed091e9..3606a253ae4 100644
--- a/unittest/mysys/thr_template.c
+++ b/unittest/mysys/thr_template.c
@@ -34,7 +34,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
bad= 0;
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
- for (i= n; i; i--)
+ for (i= 0; i < n; i++)
{
if (pthread_create(&threads[i], 0, handler, &m) != 0)
{
@@ -43,7 +43,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
}
}
- for (i= n; i; i--)
+ for (i= 0; i < n; i++)
pthread_join(threads[i], 0);
now= my_interval_timer() - now;
--
2.20.1
|