summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2009-06-01 23:57:48 +0200
committerRiku Voipio <riku.voipio@nokia.com>2009-06-16 16:58:45 +0300
commit3f9ac9b39bd82b51f6aa46103836ae12bcbcb22e (patch)
tree18f943659ece1bb8d8d4b2e5d42e0e913ea3b345 /linux-user/syscall.c
parentd5b3a9b6a9621d4b544e33f06baa3e75e6f79d7d (diff)
downloadfocaccia-qemu-3f9ac9b39bd82b51f6aa46103836ae12bcbcb22e.tar.gz
focaccia-qemu-3f9ac9b39bd82b51f6aa46103836ae12bcbcb22e.zip
linux-user: remove duplicate tswap32() from do_getsockopt()
This issue has been detected with tests/linux-tests.c:

linux-test.c:330: getsockopt

327     len = sizeof(val);
328     chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len));
329     if (val != SOCK_STREAM)
330         error("getsockopt");

In linux-user/syscall.c:do_getsockopt(), we have:
...
        val = tswap32(val);
...
            if (put_user_u32(val, optval_addr))
...

whereas "put_user_u32" calls in the end "__put_user" which uses "tswap32".

So the "val = tswap32(val);" is useless and wrong.

This patch removes it.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3ff1e04235..53a11ab877 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1348,7 +1348,6 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
         ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv));
         if (ret < 0)
             return ret;
-        val = tswap32(val);
         if (len > lv)
             len = lv;
         if (len == 4) {