[Commits] r634 - in trunk/daemon: lib src

new-commit at lists.openvcp.org new-commit at lists.openvcp.org
Sat Dec 13 12:40:33 UTC 2008


Author: ftx
Date: 2008-12-13 12:40:32 +0000 (Sat, 13 Dec 2008)
New Revision: 634

Modified:
   trunk/daemon/lib/strings.c
   trunk/daemon/lib/strings.h
   trunk/daemon/src/set.c
Log:
fixes the problem that occurse if you add an interface and the "GUEST/interface" directory doesn't exist



Modified: trunk/daemon/lib/strings.c
===================================================================
--- trunk/daemon/lib/strings.c	2008-12-11 20:49:49 UTC (rev 633)
+++ trunk/daemon/lib/strings.c	2008-12-13 12:40:32 UTC (rev 634)
@@ -179,6 +179,23 @@
 }
 
 
+
+void string_toupper(char *str)
+{
+	int i = 0;
+	
+	if(str == NULL) return;
+	
+	while(i < strlen(str))
+	{
+		
+		str[i] = toupper(str[i]);
+		i++;
+	}
+}
+
+
+
 int sconcat(char *buf, int size, ...)
 {
 	char *arg;

Modified: trunk/daemon/lib/strings.h
===================================================================
--- trunk/daemon/lib/strings.h	2008-12-11 20:49:49 UTC (rev 633)
+++ trunk/daemon/lib/strings.h	2008-12-13 12:40:32 UTC (rev 634)
@@ -28,5 +28,6 @@
 	char *string_append(char *string, char *attachment);
 	char *dec2str(int number);
 	int trim_slashes(char *string);
+	void string_toupper(char *str);
 
 #endif

Modified: trunk/daemon/src/set.c
===================================================================
--- trunk/daemon/src/set.c	2008-12-11 20:49:49 UTC (rev 633)
+++ trunk/daemon/src/set.c	2008-12-13 12:40:32 UTC (rev 634)
@@ -440,6 +440,7 @@
 
 	arg1 = ovcp_request_get_arg(request, 1);
 	flag = (char *)ovcp_data_get(arg1);
+	string_toupper(flag);
 
 	if(!ovcp_data_is_string(arg1) || flag == NULL)
 		return ovcp_response_error(OVCP_ERROR_ARGMISS, OVCP_ERROR_ARGMISS_DESC);
@@ -687,6 +688,13 @@
 
 	arg1 = ovcp_request_get_arg(request, 1);
 
+	snprintf(path, BUF_SIZE, "%s/%s/interfaces", global_settings.config_dir, name);
+	if(!dir_exist(path))
+	{
+		if(mkdir(path, 0755) != 0)
+			return ovcp_response_error(OVCP_ERROR_DIRNCREATED,
+					"vserver.add_ip: "OVCP_ERROR_DIRNCREATED_DESC);
+	}
 
 	if(ovcp_data_is_struct(arg1))
 	{



More information about the Commits mailing list