diff options
author | Wolfgang Hommel <wolfcw@users.noreply.github.com> | 2022-05-08 20:56:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 20:56:16 +0200 |
commit | 141d1a7a87a077b0f0cb4119b825089b7491baad (patch) | |
tree | 36c620ed5c6b9956ec7fc02f960e0f95a923c7a9 /src/libfaketime.c | |
parent | f836ea3eb392378bc5166b3d68283f69e5330542 (diff) | |
parent | 0f79f21e11f1928bbb081782ef50bbf1cf971316 (diff) | |
download | libfaketime-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.c | 11 |
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 */ |