summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2013-07-11 12:25:54 +0200
committerGuillem Jover <guillem@hadrons.org>2013-07-14 13:32:11 +0200
commitc5b959028734ca2281250c85773d9b5e1d259bc8 (patch)
treeed6f352dd9aa78442bc6599bfdf3c0ff13a21664 /test
parent3077d2fffc55aff310eb4f5e2bb82ba176bce5c1 (diff)
Move setproctitle() automatic initialization to its own library
The automatic initialization cannot be part of the main shared library, because there is no thread-safe way to change the environ global variable. This is not a problem if the initializaion happens just at program load time, but becomes one if the shared library is directly or indirectly dlopen()ed during the execution of the program, which could have either kept references to the old environ or could change it in some other thread. This has been observed for example on systems using Samba NSS modules. To avoid any other possible fallout, the constructor is split into a new static library that needs to be linked explicitly into programs using setproctitle(). As an additional safety measure the pkg-config linker flags will mark the program as not allowing to be dlopen()ed so that we avoid the problem described above. Reported-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66679
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 73a1e91..d0e0f0b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,6 +18,10 @@ check_PROGRAMS = \
humanize_LDFLAGS = $(top_builddir)/src/libbsd.la
fgetln_LDFLAGS = $(top_builddir)/src/libbsd.la
-proctitle_LDFLAGS = $(top_builddir)/src/libbsd.la
+proctitle_LDFLAGS = \
+ -Wl,-u,libbsd_init_func \
+ $(top_builddir)/src/libbsd-ctor.a \
+ $(top_builddir)/src/libbsd.la \
+ $(nil)
TESTS = $(check_PROGRAMS)