uClibc handles the sync_file_range2 syscall as well as sync_file_range,
passes "flags" as the last argument. However, "flags" should be the
second argument in sync_file_range2 syscall.

This patch only fixes this bug in arm, not in powerpc and mips yet. And
I expect a complete patch. Thanks!

----------------------------------------

Signed-off-by: Zheng Junling <[email protected]>
---
 libc/sysdeps/linux/common/sync_file_range.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libc/sysdeps/linux/common/sync_file_range.c 
b/libc/sysdeps/linux/common/sync_file_range.c
index 8d4ed92..db4f800 100644
--- a/libc/sysdeps/linux/common/sync_file_range.c
+++ b/libc/sysdeps/linux/common/sync_file_range.c
@@ -28,8 +28,13 @@ static int __NC(sync_file_range)(int fd, off64_t offset, 
off64_t nbytes, unsigne
        return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
                        OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
 #  else
+#   ifdef __NR_sync_file_range2
+       return INLINE_SYSCALL(sync_file_range, 6, fd, flags,
+                       OFF64_HI_LO(offset), OFF64_HI_LO(nbytes));
+#   else
        return INLINE_SYSCALL(sync_file_range, 6, fd,
                        OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
+#   endif
 #  endif
 }
 CANCELLABLE_SYSCALL(int, sync_file_range, (int fd, off64_t offset, off64_t 
nbytes, unsigned int flags), (fd, offset, nbytes, flags))
-- 
1.8.3.4

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to