2007-11-12 15:46:30

by Jeff Dike

[permalink] [raw]
Subject: [PATCH 1/2] UML - Fix recvmsg return value checking

Stupid bug - we need to compare the return value of recvmsg to the
value of iov_len, not its size. This caused port_helper processes not
to be killed on shutdown on x86_64 because the pids weren't being
passed out properly.

Signed-off-by: Jeff Dike <[email protected]>
---
arch/um/os-Linux/file.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-2.6/arch/um/os-Linux/file.c
===================================================================
--- linux-2.6.orig/arch/um/os-Linux/file.c 2007-11-12 10:26:26.000000000 -0500
+++ linux-2.6/arch/um/os-Linux/file.c 2007-11-12 10:32:30.000000000 -0500
@@ -496,8 +496,7 @@ int os_rcv_fd(int fd, int *helper_pid_ou
n = recvmsg(fd, &msg, 0);
if(n < 0)
return -errno;
-
- else if(n != sizeof(iov.iov_len))
+ else if(n != iov.iov_len)
*helper_pid_out = -1;

cmsg = CMSG_FIRSTHDR(&msg);