building on the work from Zhuowei Zhang for making write return 0 instead
of -1 when called with: write(fd, NULL, 0)

Signed-off-by: Carlo Marcelo Arenas Belón <[email protected]>
---
 linux-user/syscall.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9b6364a266..89e883f187 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10509,6 +10509,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 
arg1,
             arg4 = arg5;
             arg5 = arg6;
         }
+        if (arg2 == 0 && arg3 == 0) {
+            ret = get_errno(pwrite64(arg1, NULL, arg3, target_offset64(arg4, 
arg5)));
+            break;
+        }
         if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
             goto efault;
         ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
-- 
2.14.2


Reply via email to