Răsfoiți Sursa

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

Steven Dake 17 ani în urmă
părinte
comite
5129befb9b
1 a modificat fișierele cu 13 adăugiri și 1 ștergeri
  1. 13 1
      exec/totemsrp.c

+ 13 - 1
exec/totemsrp.c

@@ -722,7 +722,14 @@ int totemsrp_initialize (
 	}
 	}
 	
 	
 	res = mkdir (rundir, 0700);
 	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);
 	totemsrp_instance_initialize (instance);
 
 
@@ -853,8 +860,13 @@ int totemsrp_initialize (
 		MESSAGE_QUEUE_MAX,
 		MESSAGE_QUEUE_MAX,
 		sizeof (struct message_item));
 		sizeof (struct message_item));
 
 
+	hdb_handle_put (&totemsrp_instance_database, *handle);
+
 	return (0);
 	return (0);
 
 
+error_put:
+	hdb_handle_put (&totemsrp_instance_database, *handle);
+
 error_destroy:
 error_destroy:
 	hdb_handle_destroy (&totemsrp_instance_database, *handle);
 	hdb_handle_destroy (&totemsrp_instance_database, *handle);