defect 646 - wrong return code in checkpoint open

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@714 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2005-06-29 21:28:06 +00:00
parent 91c6b6d699
commit 88dea715ff
2 changed files with 28 additions and 15 deletions

View File

@ -1291,15 +1291,14 @@ static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct i
} else {
if (req_lib_ckpt_checkpointopen->checkpointCreationAttributesSet &&
memcmp (&ckptCheckpoint->checkpointCreationAttributes,
&req_lib_ckpt_checkpointopen->checkpointCreationAttributesSet,
sizeof (SaCkptCheckpointCreationAttributesT)) == 0) {
&req_lib_ckpt_checkpointopen->checkpointCreationAttributes,
sizeof (SaCkptCheckpointCreationAttributesT)) != 0) {
error = SA_AIS_ERR_EXIST;
goto error_exit;
}
}
/*
* If the checkpoint has been unlinked, it is an invalid name
*/
@ -1357,7 +1356,12 @@ error_exit:
res_lib_ckpt_checkpointopenasync.checkpointHandle = req_exec_ckpt_checkpointopen->checkpointHandle;
res_lib_ckpt_checkpointopenasync.invocation = req_exec_ckpt_checkpointopen->invocation;
libais_send_response (req_exec_ckpt_checkpointopen->source.conn_info->conn_info_partner,
libais_send_response (
req_exec_ckpt_checkpointopen->source.conn_info,
&res_lib_ckpt_checkpointopenasync,
sizeof (struct res_lib_ckpt_checkpointopenasync));
libais_send_response (
req_exec_ckpt_checkpointopen->source.conn_info->conn_info_partner,
&res_lib_ckpt_checkpointopenasync,
sizeof (struct res_lib_ckpt_checkpointopenasync));
} else {

View File

@ -351,11 +351,12 @@ saCkptDispatch (
* This instance get/listadd/put required so that close
* later has the proper list of checkpoints
*/
error = saHandleInstanceGet (&checkpointHandleDatabase,
res_lib_ckpt_checkpointopenasync->checkpointHandle,
(void *)&ckptCheckpointInstance);
assert (error == SA_AIS_OK); /* should only be valid handles here */
if (res_lib_ckpt_checkpointopenasync->header.error == SA_AIS_OK) {
error = saHandleInstanceGet (&checkpointHandleDatabase,
res_lib_ckpt_checkpointopenasync->checkpointHandle,
(void *)&ckptCheckpointInstance);
assert (error == SA_AIS_OK); /* should only be valid handles here */
/*
* open succeeded without error
*/
@ -373,11 +374,6 @@ saCkptDispatch (
/*
* open failed with error
*/
saHandleInstancePut (&checkpointHandleDatabase,
res_lib_ckpt_checkpointopenasync->checkpointHandle);
saHandleDestroy (&checkpointHandleDatabase,
res_lib_ckpt_checkpointopenasync->checkpointHandle);
callbacks.saCkptCheckpointOpenCallback(
res_lib_ckpt_checkpointopenasync->invocation,
-1,
@ -581,6 +577,7 @@ saCkptCheckpointOpenAsync (
SaCkptCheckpointHandleT checkpointHandle;
SaAisErrorT error;
struct req_lib_ckpt_checkpointopenasync req_lib_ckpt_checkpointopenasync;
struct res_lib_ckpt_checkpointopenasync res_lib_ckpt_checkpointopenasync;
if ((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) &&
checkpointCreationAttributes == NULL) {
@ -638,6 +635,19 @@ saCkptCheckpointOpenAsync (
if (error != SA_AIS_OK) {
goto error_put_destroy;
}
error = saRecvRetry (ckptCheckpointInstance->response_fd,
&res_lib_ckpt_checkpointopenasync,
sizeof (struct res_lib_ckpt_checkpointopenasync),
MSG_WAITALL | MSG_NOSIGNAL);
if (error != SA_AIS_OK) {
goto error_put_destroy;
}
if (res_lib_ckpt_checkpointopenasync.header.error != SA_AIS_OK) {
error = res_lib_ckpt_checkpointopenasync.header.error;
goto error_put_destroy;
}
pthread_mutex_init (&ckptCheckpointInstance->response_mutex, NULL);
@ -645,7 +655,7 @@ saCkptCheckpointOpenAsync (
saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
return (error);
return (error == SA_AIS_OK ? res_lib_ckpt_checkpointopenasync.header.error : error);
error_put_destroy:
saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@ -872,7 +882,6 @@ saCkptCheckpointStatusGet (
&res_lib_ckpt_checkpointstatusget.checkpointDescriptor,
sizeof (SaCkptCheckpointDescriptorT));
printf ("error is %d\n", res_lib_ckpt_checkpointstatusget.header.error);
error_exit:
saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
return (error == SA_AIS_OK ? res_lib_ckpt_checkpointstatusget.header.error : error);