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

defect 717
if checkpoint is not writeable in durationset, return error


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

Steven Dake 20 лет назад
Родитель
Сommit
6574c5f172
1 измененных файлов с 11 добавлено и 3 удалено
  1. 11 3
      lib/ckpt.c

+ 11 - 3
lib/ckpt.c

@@ -1075,12 +1075,19 @@ saCkptSectionExpirationTimeSet (
 	if (sectionId == NULL) {
 		return (SA_AIS_ERR_INVALID_PARAM);
 	}
+
 	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
 	if (error != SA_AIS_OK) {
-		goto error_exit_noput;
+		return (error);
+	}
+
+	if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
+		error = SA_AIS_ERR_ACCESS;
+		goto error_put;
 	}
 
+
 	req_lib_ckpt_sectionexpirationtimeset.header.size = sizeof (struct req_lib_ckpt_sectionexpirationtimeset) + sectionId->idLen; 
 	req_lib_ckpt_sectionexpirationtimeset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET;
 	req_lib_ckpt_sectionexpirationtimeset.idLen = sectionId->idLen;
@@ -1113,11 +1120,12 @@ saCkptSectionExpirationTimeSet (
 		sizeof (struct res_lib_ckpt_sectionexpirationtimeset),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
+error_exit:
 	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
-error_exit:
+error_put:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
-error_exit_noput:
+
 	return (error == SA_AIS_OK ? res_lib_ckpt_sectionexpirationtimeset.header.error : error);
 }