Skip to contentSkip to conversation

fix recvmsg return value

PATCH New Lauro Ramos Venancio 1 participant 1 message Oct 15, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix recvmsg return value

Recvmsg must return the number of bytes received.

Signature · 2 lines
Lauro Ramos Venancio
INdT - Instituto Nokia de Tecnologia
linux-user/syscall.c +6 -2
Index: qemu-arm-eabi/linux-user/syscall.c
===================================================================
@@ -1267,7 +1267,7 @@
 static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
                                int flags, int send)
 {
-    abi_long ret;
+    abi_long ret, len;
     struct target_msghdr *msgp;
     struct msghdr msg;
     int count;
@@ -1308,8 +1308,12 @@
             ret = get_errno(sendmsg(fd, &msg, flags));
     } else {
         ret = get_errno(recvmsg(fd, &msg, flags));
-        if (!is_error(ret))
+        if (!is_error(ret)) {
+            len = ret;
             ret = host_to_target_cmsg(msgp, &msg);
+            if (!is_error(ret))
+                ret = len;
+        }
     }
     unlock_iovec(vec, target_vec, count, !send);
 fail: