summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-08-03 11:07:59 -0400
committerColin Walters <walters@verbum.org>2016-08-03 11:39:16 -0400
commitc2ba4d879956436c1349acb0aeafd6f885276c67 (patch)
tree82fa2e6325367b25190664ddf4468082feb194cd
parent80e5af921878adfd99ec2e6cb974d88b3f6f5041 (diff)
downloadlibglnx-c2ba4d879956436c1349acb0aeafd6f885276c67.tar.gz
Add --disable-otmpfile
Some systems have bugs with it, so let's allow downstreams to easily disable it. https://bugzilla.gnome.org/show_bug.cgi?id=769453 https://github.com/ostreedev/ostree/issues/421
-rw-r--r--glnx-fdio.c2
-rw-r--r--libglnx.m49
2 files changed, 10 insertions, 1 deletions
diff --git a/glnx-fdio.c b/glnx-fdio.c
index f4648ed..8200660 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -122,7 +122,7 @@ glnx_open_tmpfile_linkable_at (int dfd,
* tempoary path name used is returned in "ret_path". Use
* link_tmpfile() below to rename the result after writing the file
* in full. */
-#ifdef O_TMPFILE
+#if defined(O_TMPFILE) && !defined(DISABLE_OTMPFILE)
fd = openat (dfd, subpath, O_TMPFILE|flags, 0600);
if (fd == -1 && !(errno == ENOSYS || errno == EISDIR || errno == EOPNOTSUPP))
{
diff --git a/libglnx.m4 b/libglnx.m4
index 6603c09..43dff97 100644
--- a/libglnx.m4
+++ b/libglnx.m4
@@ -12,4 +12,13 @@ AC_CHECK_DECLS([
#include <linux/loop.h>
#include <linux/random.h>
]])
+
+AC_ARG_ENABLE(otmpfile,
+ [AS_HELP_STRING([--disable-otmpfile],
+ [Disable use of O_TMPFILE [default=no]])],,
+ [enable_otmpfile=yes])
+AS_IF([test $enable_otmpfile = yes], [], [
+ AC_DEFINE([DISABLE_OTMPFILE], 1, [Define if we should avoid using O_TMPFILE])])
+
])
+