[pve-devel] r5677 - pve-cluster/trunk/data/src

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Mar 10 12:53:13 CET 2011


Author: dietmar
Date: 2011-03-10 12:53:13 +0100 (Thu, 10 Mar 2011)
New Revision: 5677

Modified:
   pve-cluster/trunk/data/src/status.c
Log:
store inside subdir


Modified: pve-cluster/trunk/data/src/status.c
===================================================================
--- pve-cluster/trunk/data/src/status.c	2011-03-10 11:25:43 UTC (rev 5676)
+++ pve-cluster/trunk/data/src/status.c	2011-03-10 11:53:13 UTC (rev 5677)
@@ -927,24 +927,29 @@
 	} else if (strncmp(key, "pve-storage/", 12) == 0) {
 		const char *node = key + 12;
 
-		if (strchr(node, '/') != NULL)
-			goto keyerror;
-
 		const char *storage = node;
-		while (*storage && *storage != '_')
+		while (*storage && *storage != '/')
 			storage++;
 
-		if (*storage != '_' || ((storage - node) < 1))
+		if (*storage != '/' || ((storage - node) < 1))
 			goto keyerror;
 
 		storage++;
 
+		if (strchr(storage, '/') != NULL)
+			goto keyerror;
+
 		if (strlen(storage) < 1)
 			goto keyerror;
 
 		if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
 
 			mkdir(RRDDIR "/pve-storage", 0755);
+
+			char *dir = g_path_get_dirname(filename);
+			mkdir(dir, 0755);
+			g_free(dir);
+
 			int argcount = sizeof(rrd_def_storage)/sizeof(void*) - 1;
 			create_rrd_file(filename, argcount, rrd_def_storage);
 		}




More information about the pve-devel mailing list