diff -Naur qemu-arm-0108/trunk/linux-user/syscall.c clean/linux-user/syscall.c
--- qemu-arm-0108/trunk/linux-user/syscall.c	2009-01-09 12:14:34.000000000 +0000
+++ clean/linux-user/syscall.c	2009-01-09 13:20:41.000000000 +0000
@@ -1249,7 +1249,7 @@
 static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
                                int flags, int send)
 {
-    abi_long ret;
+    abi_long ret, len = -1;
     struct target_msghdr *msgp;
     struct msghdr msg;
     int count;
@@ -1288,8 +1288,10 @@
             ret = get_errno(sendmsg(fd, &msg, flags));
     } else {
         ret = get_errno(recvmsg(fd, &msg, flags));
+        len = ret;
+        ret = host_to_target_cmsg(msgp, &msg);
         if (!is_error(ret))
-            ret = host_to_target_cmsg(msgp, &msg);
+            ret = len;
     }
     unlock_iovec(vec, target_vec, count, !send);
     unlock_user_struct(msgp, target_msg, send ? 0 : 1);
