commit c745626cdc84ce04ae3e9839a3f34d491b4985a3
parent 492b5e3952ed05a8340d08c9167687b406736b76
Author: Duncaen <mail@duncano.de>
Date: Tue, 12 Dec 2017 14:57:50 +0100
persist_timestamp: make tmpfs requirement optional and only available on linux
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/persist_timestamp.c b/persist_timestamp.c
@@ -17,10 +17,13 @@
#include "includes.h"
#ifndef TIMESTAMP_DIR
-# define TIMESTAMP_DIR "/tmp/doas"
+# define TIMESTAMP_DIR "/tmp/doas"
#endif
-#ifndef TMPFS_MAGIC
-# define TMPFS_MAGIC 0x01021994
+
+#if defined(TIMESTAMP_TMPFS) && defined(__linux__)
+# ifndef TMPFS_MAGIC
+# define TMPFS_MAGIC 0x01021994
+# endif
#endif
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
@@ -153,8 +156,11 @@ check:
errx(1, "timestamp directory is not owned by root");
if (statfs(dir, &sf) == -1)
err(1, "statfs");
+
+#if defined(TIMESTAMP_TMPFS) && defined(__linux__)
if (sf.f_type != TMPFS_MAGIC)
errx(1, "timestamp directory not on tmpfs");
+#endif
free(buf);
return 0;