summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Norton <ian.norton@ncipher.com>2022-03-18 12:03:24 +0000
committerIan Norton <ian.norton@ncipher.com>2022-03-18 12:25:55 +0000
commit2d941a894f4dbaeb6151fc3f74f932d48bec43e1 (patch)
tree95fae1b6656e99d48d0f096107a6cc954a0b026d
parentf50664f0bd8dac29effa3c4a22ea0f78a15ddbbb (diff)
downloadlibfaketime-2d941a894f4dbaeb6151fc3f74f932d48bec43e1.tar.gz
fixes #374 fix compiling without FAKE_STAT
-rw-r--r--src/libfaketime.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libfaketime.c b/src/libfaketime.c
index e632395..0c28e5f 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -830,6 +830,10 @@ static bool load_time(struct timespec *tp)
* Faked system functions: file related === FAKE(FILE)
* =======================================================================
*/
+#ifdef FAKE_UTIME
+static int fake_utime_disabled = 0;
+#endif
+
#ifdef FAKE_STAT
@@ -843,7 +847,6 @@ static bool load_time(struct timespec *tp)
#include <sys/stat.h>
static int fake_stat_disabled = 0;
-static int fake_utime_disabled = 1;
static bool user_per_tick_inc_set_backup = false;
void lock_for_stat()
@@ -2699,9 +2702,8 @@ static void ftpl_init(void)
}
#endif
#if defined FAKE_FILE_TIMESTAMPS
-#ifndef FAKE_UTIME
- fake_utime_disabled = 0; // Defaults to enabled w/o FAKE_UTIME define
-#endif
+#ifdef FAKE_UTIME
+ // fake_utime_disabled is 0 by default
if ((tmp_env = getenv("FAKE_UTIME")) != NULL) //Note that this is NOT re-checked
{
if (!*tmp_env || *tmp_env == 'y' || *tmp_env == 'Y' || *tmp_env == 't' || *tmp_env == 'T')
@@ -2713,6 +2715,10 @@ static void ftpl_init(void)
fake_utime_disabled = !atoi(tmp_env);
}
}
+#else
+ // compiled without FAKE_UTIME support, so don't allow it to be controlled by the env var
+ fake_utime_disabled = 1;
+#endif
#endif
if ((tmp_env = getenv("FAKETIME_CACHE_DURATION")) != NULL)