فهرست منبع

Endian cleanup for ykd.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1167 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 19 سال پیش
والد
کامیت
308b9db63b
1فایلهای تغییر یافته به همراه11 افزوده شده و 5 حذف شده
  1. 11 5
      exec/vsf_ykd.c

+ 11 - 5
exec/vsf_ykd.c

@@ -1,10 +1,11 @@
 /*
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
  * Copyright (c) 2005 MontaVista Software, Inc.
  * Copyright (c) 2006 Red Hat, Inc.
  * Copyright (c) 2006 Red Hat, Inc.
+ * Author: Steven Dake (sdake@mvista.com)
  *
  *
- * All rights reserved.
+ * Copyright (c) 2006 Sun Microsystems, Inc.
  *
  *
- * Author: Steven Dake (sdake@mvista.com)
+ * All rights reserved.
  *
  *
  * This software licensed under BSD license, the text of which follows:
  * This software licensed under BSD license, the text of which follows:
  * 
  * 
@@ -32,6 +33,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
+
 #include <assert.h>
 #include <assert.h>
 #include <pwd.h>
 #include <pwd.h>
 #include <grp.h>
 #include <grp.h>
@@ -302,10 +304,12 @@ static void ykd_session_endian_convert (struct ykd_session *ykd_session)
 {
 {
 	int i;
 	int i;
 
 
-	ykd_session->member_list_entries = swab32 (ykd_session->member_list_entries);
+	ykd_session->member_list_entries =
+		swab32 (ykd_session->member_list_entries);
 	ykd_session->session_id = swab32 (ykd_session->session_id);
 	ykd_session->session_id = swab32 (ykd_session->session_id);
 	for (i = 0; i < ykd_session->member_list_entries; i++) {
 	for (i = 0; i < ykd_session->member_list_entries; i++) {
-// TODO		totemip_copy_endian_convert (&ykd_session->member_list[i], &ykd_session->member_list[i]);
+		ykd_session->member_list[i] =
+			swab32 (ykd_session->member_list[i]);
 	}
 	}
 }
 }
 
 
@@ -355,7 +359,8 @@ static void ykd_deliver_fn (
 		return;
 		return;
 	}
 	}
 #endif
 #endif
-	if (endian_conversion_required) {
+	if (endian_conversion_required &&
+	    (iovec->iov_len > sizeof (struct ykd_header))) {
 		ykd_state_endian_convert ((struct ykd_state *)msg_state);
 		ykd_state_endian_convert ((struct ykd_state *)msg_state);
 	}
 	}
 
 
@@ -384,6 +389,7 @@ static void ykd_deliver_fn (
 
 
 	switch (ykd_mode) {
 	switch (ykd_mode) {
 		case YKD_MODE_SENDSTATE:
 		case YKD_MODE_SENDSTATE:
+			assert (iovec->iov_len > sizeof (struct ykd_header));
 			/*
 			/*
 			 * Copy state information for the sending processor
 			 * Copy state information for the sending processor
 			 */
 			 */