Browse Source

coroipcc: Fix unhandled BSD EOF in coroipcc_dispatch_get()

Signed-off-by: Jerome Flesch <jerome.flesch@netasq.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Jerome Flesch 14 years ago
parent
commit
76426d7901
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lib/coroipcc.c

+ 7 - 0
lib/coroipcc.c

@@ -872,6 +872,13 @@ coroipcc_dispatch_get (
 	}
 
 	error = socket_recv (ipc_instance->fd, &buf, 1);
+#if defined(COROSYNC_SOLARIS) || defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN)
+	/* On many OS poll() never returns POLLHUP or POLLERR.
+	 * EOF is detected when recvmsg() return 0.
+	 */
+	if ( error == CS_ERR_LIBRARY )
+		goto error_put;
+#endif
 	assert (error == CS_OK);
 
 	if (shared_mem_dispatch_bytes_left (ipc_instance) > 500000) {