summaryrefslogtreecommitdiff
path: root/src/libfaketime.c
diff options
context:
space:
mode:
authorWolfgang Hommel <wolfcw@users.noreply.github.com>2022-05-08 20:56:16 +0200
committerGitHub <noreply@github.com>2022-05-08 20:56:16 +0200
commit141d1a7a87a077b0f0cb4119b825089b7491baad (patch)
tree36c620ed5c6b9956ec7fc02f960e0f95a923c7a9 /src/libfaketime.c
parentf836ea3eb392378bc5166b3d68283f69e5330542 (diff)
parent0f79f21e11f1928bbb081782ef50bbf1cf971316 (diff)
downloadlibfaketime-141d1a7a87a077b0f0cb4119b825089b7491baad.tar.gz
Merge pull request #389 from psychon/asan
Work-around / fix libasan incompatibility
Diffstat (limited to 'src/libfaketime.c')
-rw-r--r--src/libfaketime.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libfaketime.c b/src/libfaketime.c
index f92ecf8..ec80ec8 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -2282,6 +2282,16 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp)
if (!initialized)
{
recursion_depth++;
+#ifdef FAIL_PRE_INIT_CALLS
+ fprintf(stderr, "libfaketime: clock_gettime() was called before initialization.\n");
+ fprintf(stderr, "libfaketime: Returning -1 on clock_gettime().\n");
+ if (tp != NULL)
+ {
+ tp->tv_sec = 0;
+ tp->tv_nsec = 0;
+ }
+ return -1;
+#else
if (recursion_depth == 2)
{
fprintf(stderr, "libfaketime: Unexpected recursive calls to clock_gettime() without proper initialization. Trying alternative.\n");
@@ -2302,6 +2312,7 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp)
else {
ftpl_init();
}
+#endif
recursion_depth--;
}
/* sanity check */