瀏覽代碼

Add rundir patch to /var/lib/openais.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1326 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 19 年之前
父節點
當前提交
76e46a1d60
共有 1 個文件被更改,包括 14 次插入4 次删除
  1. 14 4
      exec/totemsrp.c

+ 14 - 4
exec/totemsrp.c

@@ -601,6 +601,8 @@ struct message_handlers totemsrp_message_handlers = {
 	}
 };
 
+static char *rundir = NULL;
+
 #define log_printf(level, format, args...) \
     instance->totemsrp_log_printf (__FILE__, __LINE__, level, format, ##args)
 
@@ -687,6 +689,14 @@ int totemsrp_initialize (
 		goto error_destroy;
 	}
 
+	rundir = getenv ("OPENAIS_RUN_DIR");
+	if (rundir == NULL) {
+		rundir = "/var/lib/openais";
+	}
+	
+	res = mkdir (rundir, 0700);
+	chdir (rundir);
+
 	totemsrp_instance_initialize (instance);
 
 	instance->totem_config = totem_config;
@@ -2771,9 +2781,9 @@ static void memb_ring_id_create_or_load (
 	int res;
 	char filename[256];
 
-	sprintf (filename, "/tmp/ringid_%s",
-		totemip_print (&instance->my_id.addr[0]));
-	fd = open (filename, O_RDONLY, 0777);
+	sprintf (filename, "%s/ringid_%s",
+		rundir, totemip_print (&instance->my_id.addr[0]));
+	fd = open (filename, O_RDONLY, 0700);
 	if (fd > 0) {
 		res = read (fd, &memb_ring_id->seq, sizeof (unsigned long long));
 		assert (res == sizeof (unsigned long long));
@@ -2782,7 +2792,7 @@ static void memb_ring_id_create_or_load (
 	if (fd == -1 && errno == ENOENT) {
 		memb_ring_id->seq = 0;
 		umask(0);
-		fd = open (filename, O_CREAT|O_RDWR, 0777);
+		fd = open (filename, O_CREAT|O_RDWR, 0700);
 		if (fd == -1) {
 			log_printf (instance->totemsrp_log_level_warning,
 				"Couldn't create %s %s\n", filename, strerror (errno));