Skip to content

Commit

Permalink
Disable FAILRE_PRE_INIT_CALLS by default
Browse files Browse the repository at this point in the history
Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon committed May 8, 2022
1 parent fff49b2 commit 450d5d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
# without this, but the performance impact may require you to
# try it unsynchronized.
#
# FAIL_PRE_INIT_CALLS
# - If the time is queried before the library was initialised, let the
# call fail instead of trying to initialise on-the-fly. This fixes /
# works around hangs that were seen with address sanitizer.
#
# * Compilation Defines that are unset by default:
#
# FAKE_FILE_TIMESTAMPS, FAKE_UTIME
Expand Down Expand Up @@ -89,6 +84,11 @@
# - avoid that the faketime wrapper complains when running within a
# libfaketime environment
#
# FAIL_PRE_INIT_CALLS
# - If the time is queried before the library was initialised, let the
# call fail instead of trying to initialise on-the-fly. This fixes /
# works around hangs that were seen with address sanitizer.
#
# * Compilation addition: second libMT target added for building the pthread-
# enabled library as a separate library
#
Expand All @@ -115,7 +115,7 @@ PREFIX ?= /usr/local
LIBDIRNAME ?= /lib/faketime
PLATFORM ?=$(shell uname)

CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -DFAIL_PRE_INIT_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)
CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)
ifeq ($(PLATFORM),SunOS)
CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
endif
Expand Down
4 changes: 4 additions & 0 deletions test/libmallocintercept.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static void* actual_malloc(size_t size) {
}

static void poke_faketime(void) {
#ifdef FAIL_PRE_INIT_CALLS
/* To complicate things for libfaketime, this calls clock_gettime()
* while holding a lock. This should simulate problems that occurred
* with address sanitizer.
Expand All @@ -60,6 +61,9 @@ static void poke_faketime(void) {
pthread_mutex_lock(&time_mutex);
clock_gettime(CLOCK_REALTIME, &timespec);
pthread_mutex_unlock(&time_mutex);
#else
print_msg("FAIL_PRE_INIT_CALLS not defined, skipping poke_faketime() ");
#endif
}

void *malloc(size_t size) {
Expand Down

0 comments on commit 450d5d4

Please sign in to comment.