]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/replace: use syscall(__NR_openat2) if available
authorStefan Metzmacher <metze@samba.org>
Mon, 8 Aug 2022 13:25:39 +0000 (15:25 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 15 Aug 2022 15:03:37 +0000 (15:03 +0000)
There's no glibc wrapper for openat2() yet, so we need
to use syscall(__NR_openat2) ourself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/replace/replace.c

index e937d81dbd143425eacc712cdab08e271e7c4e50..5ec2f7ccc56ba81f484eca4786b4e7ffa15b502f 100644 (file)
@@ -1087,7 +1087,15 @@ ssize_t rep_copy_file_range(int fd_in,
 long rep_openat2(int dirfd, const char *pathname,
                 struct open_how *how, size_t size)
 {
+#ifdef __NR_openat2
+       return syscall(__NR_openat2,
+                      dirfd,
+                      pathname,
+                      how,
+                      size);
+#else
        errno = ENOSYS;
        return -1;
+#endif
 }
 #endif /* !HAVE_OPENAT2 */