Procházet zdrojové kódy

Patch from Jerome to fix segfault in dispatch functions.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2468 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake před 16 roky
rodič
revize
b3f661d295
1 změnil soubory, kde provedl 9 přidání a 4 odebrání
  1. 9 4
      lib/coroipcc.c

+ 9 - 4
lib/coroipcc.c

@@ -837,12 +837,15 @@ coroipcc_dispatch_get (
 		goto error_put;
 	} else
 	if (res == -1) {
+		error = CS_ERR_LIBRARY;
 		goto error_put;
-	}
+	} else
 	if (res == 0) {
-#if defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN)
+		/* Means that the peer closed cleanly the socket. However, it should
+		 * happen only on BSD and Darwing systems since poll() returns a
+		 * POLLHUP event on other systems.
+		 */
 		error = CS_ERR_LIBRARY;
-#endif
 		goto error_put;
 	}
 	ipc_instance->flow_control_state = 0;
@@ -862,9 +865,11 @@ coroipcc_dispatch_get (
 	 * of a new pending message, not a message to dispatch
 	 */
 	if (buf == 2) {
+		error = CS_ERR_TRY_AGAIN;
 		goto error_put;
 	}
 	if (buf == 3) {
+		error = CS_ERR_TRY_AGAIN;
 		goto error_put;
 	}
 
@@ -874,7 +879,7 @@ coroipcc_dispatch_get (
 
 	*data = (void *)data_addr;
 
-	return (CS_OK);
+	error = CS_OK;
 error_put:
 	hdb_handle_put (&ipc_hdb, handle);
 	return (error);