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

defect 739
saCkptCheckpointOpenAsync callback doesn't return error as per spec


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@757 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
73a30f9921
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      lib/ckpt.c

+ 9 - 2
lib/ckpt.c

@@ -611,6 +611,9 @@ saCkptCheckpointOpenAsync (
 	struct res_lib_ckpt_checkpointopenasync res_lib_ckpt_checkpointopenasync;
 	SaAisErrorT failWithError = SA_AIS_OK;
 
+	if (checkpointName == NULL) {
+		failWithError = SA_AIS_ERR_INVALID_PARAM;
+	} else
 	if (checkpointOpenFlags &
 		~(SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE|SA_CKPT_CHECKPOINT_CREATE)) {
 		failWithError = SA_AIS_ERR_BAD_FLAGS;
@@ -648,13 +651,17 @@ saCkptCheckpointOpenAsync (
 	ckptCheckpointInstance->ckptHandle = ckptHandle;
 	ckptCheckpointInstance->checkpointHandle = checkpointHandle;
 	ckptCheckpointInstance->checkpointOpenFlags = checkpointOpenFlags;
-	memcpy (&ckptCheckpointInstance->checkpointName, checkpointName, sizeof (SaNameT));
+	if (failWithError == SA_AIS_OK) {
+		memcpy (&ckptCheckpointInstance->checkpointName, checkpointName,
+			sizeof (SaNameT));
+		memcpy (&req_lib_ckpt_checkpointopenasync.checkpointName,
+			checkpointName, sizeof (SaNameT));
+	}
 
 	req_lib_ckpt_checkpointopenasync.header.size = sizeof (struct req_lib_ckpt_checkpointopenasync);
 	req_lib_ckpt_checkpointopenasync.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC;
 	req_lib_ckpt_checkpointopenasync.invocation = invocation;
 	req_lib_ckpt_checkpointopenasync.fail_with_error = failWithError;
-	memcpy (&req_lib_ckpt_checkpointopenasync.checkpointName, checkpointName, sizeof (SaNameT));
 	req_lib_ckpt_checkpointopenasync.checkpointCreationAttributesSet = 0;
 	if (checkpointCreationAttributes) {
 		memcpy (&req_lib_ckpt_checkpointopenasync.checkpointCreationAttributes,