From 6574c5f172eb439e95701b24dbb69d1c775b38c4 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Wed, 13 Jul 2005 20:12:49 +0000 Subject: [PATCH] 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 --- lib/ckpt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ckpt.c b/lib/ckpt.c index 847fd5f9..2f879617 100644 --- a/lib/ckpt.c +++ b/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); }