Просмотр исходного кода

totem: Propagate totem initialization failure

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 8 лет назад
Родитель
Сommit
564b4bf7d4
3 измененных файлов с 16 добавлено и 3 удалено
  1. 6 2
      exec/main.c
  2. 5 0
      exec/totempg.c
  3. 5 1
      exec/totemsrp.c

+ 6 - 2
exec/main.c

@@ -1350,9 +1350,13 @@ int main (int argc, char **argv, char **envp)
 	 * Join multicast group and setup delivery
 	 *  and configuration change functions
 	 */
-	totempg_initialize (
+	if (totempg_initialize (
 		corosync_poll_handle,
-		&totem_config);
+		&totem_config) != 0) {
+
+		log_printf (LOGSYS_LEVEL_ERROR, "Can't initialize TOTEM layer");
+		corosync_exit_error (COROSYNC_DONE_FATAL_ERR);
+	}
 
 	totempg_service_ready_register (
 		main_service_ready);

+ 5 - 0
exec/totempg.c

@@ -802,6 +802,10 @@ int totempg_initialize (
 		totempg_confchg_fn,
 		totempg_waiting_trans_ack_cb);
 
+	if (res == -1) {
+		goto error_exit;
+	}
+
 	totemsrp_callback_token_create (
 		totemsrp_context,
 		&callback_token_received_handle,
@@ -816,6 +820,7 @@ int totempg_initialize (
 
 	qb_list_init (&totempg_groups_list);
 
+error_exit:
 	return (res);
 }
 

+ 5 - 1
exec/totemsrp.c

@@ -834,6 +834,7 @@ int totemsrp_initialize (
 		int waiting_trans_ack))
 {
 	struct totemsrp_instance *instance;
+	int res;
 
 	instance = malloc (sizeof (struct totemsrp_instance));
 	if (instance == NULL) {
@@ -959,7 +960,7 @@ int totemsrp_initialize (
 		}
 	}
 
-	totemnet_initialize (
+	res = totemnet_initialize (
 		poll_handle,
 		&instance->totemnet_context,
 		totem_config,
@@ -969,6 +970,9 @@ int totemsrp_initialize (
 		main_iface_change_fn,
 		totempg_mtu_changed,
 		target_set_completed);
+	if (res == -1) {
+		goto error_exit;
+	}
 
 	/*
 	 * Must have net_mtu adjusted by totemnet_initialize first