summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-28 13:25:51 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-28 13:25:51 +0100
commitc09918f97a3c2fc4c8320d327eafd287bc2138da (patch)
tree29e1cc370d355f5459ed63782357e5aed740b8b2 /src/shared
parenta6afc4aeaa5018859f8c8a397001ee4e3794545e (diff)
util: define O_TMPFILE on x86/x86-64, where the generic value is used
On other archs we'll not define it so that open_tmpfile() falls back to unguessable name + unlink.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/missing.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/missing.h b/src/shared/missing.h
index 4e62100030..939f81d9c4 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -327,3 +327,19 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
#ifndef TMP_MAX
# define TMP_MAX 238328
#endif
+
+#if defined(__i386__) || defined(__x86_64__)
+
+/* The precise definition of __O_TMPFILE is arch specific, so let's
+ * just define this on x86 where we know the value. */
+
+#ifndef __O_TMPFILE
+#define __O_TMPFILE 020000000
+#endif
+
+/* a horrid kludge trying to make sure that this will fail on old kernels */
+#ifndef O_TMPFILE
+#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
+#endif
+
+#endif