summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWolfgang Hommel <wolfgang.hommel@unibw.de>2022-02-20 20:40:19 +0100
committerWolfgang Hommel <wolfgang.hommel@unibw.de>2022-02-20 20:40:19 +0100
commit9dcaf53fd7cdcded8dc51f6ecea2ad4a5f51385e (patch)
treef7886e2b039ab1c84955be92a15fb81286bad9e7 /src
parent02bc1fccae8b464060931f125caae347af33ad3f (diff)
downloadlibfaketime-9dcaf53fd7cdcded8dc51f6ecea2ad4a5f51385e.tar.gz
faketime wrapper complains when env vars are set unless comp/w SILENT (closes #307)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile4
-rw-r--r--src/faketime.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index c1b890d..62e924c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -80,6 +80,10 @@
# ld automatically choose the correct library version to use for the
# target binary. Use for Linux platforms with Multi-Arch support only!
#
+# SILENT
+# - avoid that the faketime wrapper complains when running within a
+# libfaketime environment
+#
# * Compilation addition: second libMT target added for building the pthread-
# enabled library as a separate library
#
diff --git a/src/faketime.c b/src/faketime.c
index 5dd4c0a..d848509 100644
--- a/src/faketime.c
+++ b/src/faketime.c
@@ -114,6 +114,12 @@ int main (int argc, char **argv)
bool fake_pid = false;
const char *pid_val;
+#ifndef SILENT
+ if (getenv("FAKETIME") || getenv("FAKETIME_SHARED") || getenv("FAKETIME_FAKEPID") || getenv("FAKERANDOM_SEED")) {
+ fprintf(stderr, "faketime: You appear to be running faketime within a libfaketime environment. Proceeding, but check for unexpected results...\n");
+ }
+#endif
+
while (curr_opt < argc)
{
if (0 == strcmp(argv[curr_opt], "-m"))