From 5129befb9bc112c821df62c92fce5a238b82a2bb Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Tue, 10 Mar 2009 11:30:34 +0000 Subject: [PATCH] Add missing hdb_handle_put in totemsrp and handle errors in mkdir and chdir properly. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1818 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/totemsrp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/exec/totemsrp.c b/exec/totemsrp.c index fc94baf4..baa18e61 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -722,7 +722,14 @@ int totemsrp_initialize ( } res = mkdir (rundir, 0700); - chdir (rundir); + if (res == -1) { + goto error_put; + } + + res = chdir (rundir); + if (res == -1) { + goto error_put; + } totemsrp_instance_initialize (instance); @@ -853,8 +860,13 @@ int totemsrp_initialize ( MESSAGE_QUEUE_MAX, sizeof (struct message_item)); + hdb_handle_put (&totemsrp_instance_database, *handle); + return (0); +error_put: + hdb_handle_put (&totemsrp_instance_database, *handle); + error_destroy: hdb_handle_destroy (&totemsrp_instance_database, *handle);