diff --git a/glnx-fdio.c b/glnx-fdio.c index 19144da7c78c3be949f8692ccfbc3cee8313ef10..7ee57cd6ae80ddacdaec06825d8d034a9d67b6b2 100644 --- a/glnx-fdio.c +++ b/glnx-fdio.c @@ -60,6 +60,7 @@ rename_file_noreplace_at (int olddirfd, const char *oldpath, gboolean ignore_eexist, GError **error) { +#ifndef ENABLE_WRPSEUDO_COMPAT if (renameat2 (olddirfd, oldpath, newdirfd, newpath, RENAME_NOREPLACE) < 0) { if (errno == EINVAL || errno == ENOSYS) @@ -80,6 +81,7 @@ rename_file_noreplace_at (int olddirfd, const char *oldpath, } else return TRUE; +#endif if (linkat (olddirfd, oldpath, newdirfd, newpath, 0) < 0) { @@ -122,7 +124,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. */ -#if defined(O_TMPFILE) && !defined(DISABLE_OTMPFILE) +#if defined(O_TMPFILE) && !defined(DISABLE_OTMPFILE) && !defined(ENABLE_WRPSEUDO_COMPAT) 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 43dff9755610688feb525e55040c7158cf6ada17..9b2e30c9092dead54418b15d4dc64747dabcb8f8 100644 --- a/libglnx.m4 +++ b/libglnx.m4 @@ -20,5 +20,12 @@ AC_ARG_ENABLE(otmpfile, AS_IF([test $enable_otmpfile = yes], [], [ AC_DEFINE([DISABLE_OTMPFILE], 1, [Define if we should avoid using O_TMPFILE])]) -]) +AC_ARG_ENABLE(wrpseudo-compat, + [AS_HELP_STRING([--enable-wrpseudo-compat], + [Disable use syscall() and filesystem calls to for compatibility with wrpseudo [default=no]])],, + [enable_wrpseudo_compat=no]) +AS_IF([test $enable_wrpseudo_compat = no], [], [ + AC_DEFINE([ENABLE_WRPSEUDO_COMPAT], 1, [Define if we should be compatible with wrpseudo])]) +dnl end LIBGLNX_CONFIGURE +])