aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/test
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-13 17:23:41 +0200
committerSverker Eriksson <[email protected]>2016-05-13 17:25:56 +0200
commitbe923fedf5b2496ac2b8da1afaae54635410891f (patch)
treeca461f53f74576d3f810db6675d017652bec46e9 /lib/erl_interface/test
parent5ca152a5ccca92e354188f7b696ca5b9f6b92806 (diff)
downloadotp-be923fedf5b2496ac2b8da1afaae54635410891f.tar.gz
otp-be923fedf5b2496ac2b8da1afaae54635410891f.tar.bz2
otp-be923fedf5b2496ac2b8da1afaae54635410891f.zip
erl_interface: Fix race bug in ei tests on OpenBSD
Must call erl_init() to create mutex "ei_gethost_sem". The lazy initialization done in my_gethostbyname_r is not thread-safe.
Diffstat (limited to 'lib/erl_interface/test')
-rw-r--r--lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src3
-rw-r--r--lib/erl_interface/test/ei_connect_SUITE_data/einode.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src b/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src
index 5b82f0bfcf..c2d8261dd8 100644
--- a/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src
+++ b/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src
@@ -23,9 +23,10 @@ include @erl_interface_mk_include@
CC0 = @CC@
CC = ..@DS@all_SUITE_data@DS@gccifier@exe@ -CC"$(CC0)"
LD = @LD@
+LIBERL = @erl_interface_lib@
LIBEI = @erl_interface_eilib@
LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \
- $(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
+ $(LIBERL) $(LIBEI) @LIBS@ @erl_interface_sock_libs@ \
@erl_interface_threadlib@
CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data
EI_CONNECT_OBJS = ei_connect_test@obj@ ei_connect_test_decl@obj@
diff --git a/lib/erl_interface/test/ei_connect_SUITE_data/einode.c b/lib/erl_interface/test/ei_connect_SUITE_data/einode.c
index e1d46ae59a..bb71575740 100644
--- a/lib/erl_interface/test/ei_connect_SUITE_data/einode.c
+++ b/lib/erl_interface/test/ei_connect_SUITE_data/einode.c
@@ -35,6 +35,7 @@
#endif
#include "ei.h"
+#include "erl_interface.h"
#ifdef VXWORKS
#define MAIN cnode
@@ -115,6 +116,8 @@ MAIN(int argc, char *argv[])
if (argc < 3)
exit(1);
+ erl_init(NULL, 0);
+
cookie = argv[1];
n = atoi(argv[2]);
if (n > 100)