summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2022-11-23 11:38:20 +0100
committerStefan Metzmacher <metze@samba.org>2022-11-24 11:01:37 +0000
commit6dddb268df08fd91f8e0f189f948ad76e5805dca (patch)
tree6095255688f3d68ce05f5ef944efe612e1cfa878 /lib/replace
parent4c2e1d6259c4c06fce5d1333553b611ffd8f0ef4 (diff)
downloadsamba-6dddb268df08fd91f8e0f189f948ad76e5805dca.tar.gz
lib/replace: let rep_openat2() inject O_LARGEFILE as needed
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15251 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/replace.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index cbf372e494f..68829f2a3c9 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -1116,6 +1116,22 @@ long rep_openat2(int dirfd, const char *pathname,
struct open_how *how, size_t size)
{
#ifdef __NR_openat2
+#if _FILE_OFFSET_BITS == 64 && SIZE_MAX == 0xffffffffUL && defined(O_LARGEFILE)
+ struct open_how __how;
+
+#if defined(O_PATH) && ! defined(DISABLE_OPATH)
+ if ((how->flags & O_PATH) == 0)
+#endif
+ {
+ if (sizeof(__how) == size) {
+ __how = *how;
+
+ __how.flags |= O_LARGEFILE;
+ how = &__how;
+ }
+ }
+#endif
+
return syscall(__NR_openat2,
dirfd,
pathname,