diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | libsandbox.c | 12 |
3 files changed, 11 insertions, 9 deletions
@@ -2,6 +2,10 @@ # Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2 # $Header$ + 14 Mar 2005; Martin Schlemmer <azarah@gentoo.org> Makefile.am, libsandbox.c: + Seems -nostdlib was the problem with the constructor/destructor - remove it + from Makefile.am, and change the constructor/destructor names again. + 14 Mar 2005; Martin Schlemmer <azarah@gentoo.org> libsandbox.c: Also rename the _init() and _fini() declarations. diff --git a/Makefile.am b/Makefile.am index 5a04dad..7673ebd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,9 @@ dist_pkgdata_DATA = sandbox.bashrc lib_LTLIBRARIES = libsandbox.la libsandbox_la_SOURCES = libsandbox.c sandbox_futils.c localdecls.h -libsandbox_la_LDFLAGS = -Wc,-nostdlib -Wc,-nodefaultlibs -lc -ldl +# Do not add -nostdlib or -nostartfiles, as then our constructor +# and destructor will not be executed ... +libsandbox_la_LDFLAGS = -nodefaultlibs -lc -ldl # We need -fexceptions here, else we do not catch exceptions # (nptl/tst-cancelx4.c in glibc among others fails for wrapped functions). libsandbox_la_CFLAGS = -fexceptions diff --git a/libsandbox.c b/libsandbox.c index a5b8831..6add3ea 100644 --- a/libsandbox.c +++ b/libsandbox.c @@ -136,8 +136,8 @@ typedef struct { int num_write_denied_prefixes; } sbcontext_t; -void __attribute__ ((constructor)) _init(void); -void __attribute__ ((destructor)) _fini(void); +void __attribute__ ((constructor)) libsb_init(void); +void __attribute__ ((destructor)) libsb_fini(void); /* glibc modified realpath() functions */ static char *erealpath(const char *name, char *resolved); @@ -275,16 +275,12 @@ static void *get_dlsym(const char *symname, const char *symver) } -/* Apparently this attribute is needed, but testing still shows it - * needs to be named '_fini', so DO NOT CHANGE ! */ -void __attribute__ ((destructor)) _fini(void) +void __attribute__ ((destructor)) libsb_fini(void) { free(sandbox_pids_file); } -/* Apparently this attribute is needed, but testing still shows it - * needs to be named '_init', so DO NOT CHANGE ! */ -void __attribute__ ((constructor)) _init(void) +void __attribute__ ((constructor)) libsb_init(void) { int old_errno = errno; char *tmp_string = NULL; |