summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Hommel <wolfcw@users.noreply.github.com>2022-03-18 19:31:35 +0100
committerGitHub <noreply@github.com>2022-03-18 19:31:35 +0100
commit0ca35dd8c4532075d6805133a8f2f319f54c26ff (patch)
tree95fae1b6656e99d48d0f096107a6cc954a0b026d
parentf50664f0bd8dac29effa3c4a22ea0f78a15ddbbb (diff)
parent2d941a894f4dbaeb6151fc3f74f932d48bec43e1 (diff)
downloadlibfaketime-0ca35dd8c4532075d6805133a8f2f319f54c26ff.tar.gz
Merge pull request #375 from inorton/fix_374_UFAKE_STAT
fixes #374 fix compiling without FAKE_STAT or with FAKE_UTIME
-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)