diff --git a/glnx-fdio.c b/glnx-fdio.c index f4648ed8db5ab8cbb327c6f4d23932089fdf5c1b..82006604e79d878d22b29a210c8abc7d8b70780e 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 6603c0922fb1b3c1bbd57905eef9e8018323c577..43dff9755610688feb525e55040c7158cf6ada17 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])]) + ]) +