qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: fix special case pwrite64 with count = 0
@ 2017-10-01  0:34 Carlo Marcelo Arenas Belón
  0 siblings, 0 replies; only message in thread
From: Carlo Marcelo Arenas Belón @ 2017-10-01  0:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: zhuoweizhang, laurent, peter.maydell,
	Carlo Marcelo Arenas Belón

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 <carenas@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-01  0:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-01  0:34 [Qemu-devel] [PATCH] linux-user: fix special case pwrite64 with count = 0 Carlo Marcelo Arenas Belón

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).