diff options
author | Ilya Palachev <i.palachev@samsung.com> | 2014-12-17 13:55:55 +0300 |
---|---|---|
committer | Ilya Palachev <i.palachev@samsung.com> | 2014-12-17 14:53:18 +0300 |
commit | 77f41a5cae59c0faa5384af809649f42e6667144 (patch) | |
tree | 0d218da3fc585949ef288eb0fdbaeede371e7e30 | |
parent | 1b2063324897e07f2f16e6f9867bde080d2851ae (diff) | |
download | qemu-77f41a5cae59c0faa5384af809649f42e6667144.tar.gz qemu-77f41a5cae59c0faa5384af809649f42e6667144.tar.bz2 qemu-77f41a5cae59c0faa5384af809649f42e6667144.zip |
Force pread64/pwrite64 to return 0 for zero-length buffersubmit/tizen_wearable/20150204.011455submit/tizen_wearable/20150202.034712submit/tizen_tv/20150204.012408submit/tizen_mobile/20150204.011944submit/tizen_mobile/20150129.000000submit/tizen_ivi/20150206.082313submit/tizen_common/20150224.160311submit/tizen_common/20150127.143638submit/tizen_3.0.2014.q4_common/20150224.132718accepted/tizen/wearable/20150204.014315accepted/tizen/tv/20150206.074811accepted/tizen/mobile/20150205.042645accepted/tizen/common/20150127.151335accepted/tizen/3.0.2014.q4/common/20150224.133827
According to official standard POSIX.1-2001. pread64 and pwrite64
should return 0 for zero-length buffers as mentioned at
http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html
http://pubs.opengroup.org/onlinepubs/009695399/functions/write.html
Change-Id: Icd66ea29658329fbd5e6461d1def0c78c81d2671
Signed-off-by: Ilya Palachev <i.palachev@samsung.com>
-rw-r--r-- | linux-user/syscall.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a41dd43b5..a08f5efb0 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8127,6 +8127,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1, arg4 = arg5; arg5 = arg6; } + if (!arg3) { + ret = 0; + break; + } if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) goto efault; ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); @@ -8137,6 +8141,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1, arg4 = arg5; arg5 = arg6; } + if (!arg3) { + ret = 0; + break; + } if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) goto efault; ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); |