chiark / gitweb /
always use the same code for creating temporary files
[elogind.git] / src / shared / missing.h
index 4e62100030b0b58438f955cea102f406ba150328..939f81d9c4c02f875f545c48f453f35035f140f2 100644 (file)
@@ -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