[Commits] r650 - trunk/daemon/src

new-commit at lists.openvcp.org new-commit at lists.openvcp.org
Fri Feb 6 15:48:09 UTC 2009


Author: ftx
Date: 2009-02-06 15:48:08 +0000 (Fri, 06 Feb 2009)
New Revision: 650

Modified:
   trunk/daemon/src/error.h
   trunk/daemon/src/request.c
Log:
additional check for rescue mode



Modified: trunk/daemon/src/error.h
===================================================================
--- trunk/daemon/src/error.h	2009-02-05 18:27:39 UTC (rev 649)
+++ trunk/daemon/src/error.h	2009-02-06 15:48:08 UTC (rev 650)
@@ -45,7 +45,8 @@
 	#define OVCP_ERROR_NORESCUEIMG	22
 	#define OVCP_ERROR_UABLRESTORE	23
 	#define OVCP_ERROR_NOTSTOPPED	24
-			
+	#define OVCP_ERROR_UABLDELETE	25
+		
 	#define OVCP_ERROR_OUTOFMEM_DESC	"Out of Memory."
 	#define OVCP_ERROR_ARGMISS_DESC 	"Argument Missing."
 	#define OVCP_ERROR_WRONGTYPE_DESC	"Argument has the wrong Type."
@@ -71,6 +72,7 @@
 	#define OVCP_ERROR_NORESCUEIMG_DESC	"Rescue Image not found"
 	#define OVCP_ERROR_UABLRESTORE_DESC	"Unable to restore backup"
 	#define OVCP_ERROR_NOTSTOPPED_DESC	"VServer shouldn't be running"
+	#define OVCP_ERROR_UABLDELETE_DESC	"Unable to delete directory"
 #endif
 
 

Modified: trunk/daemon/src/request.c
===================================================================
--- trunk/daemon/src/request.c	2009-02-05 18:27:39 UTC (rev 649)
+++ trunk/daemon/src/request.c	2009-02-06 15:48:08 UTC (rev 650)
@@ -318,6 +318,9 @@
 		if(execb_cmd("mv", "mv", srcpath, destpath, NULL) != 0)
 			return ovcp_response_error(OVCP_ERROR_BACKUPFAIL, OVCP_ERROR_BACKUPFAIL_DESC);
 	
+		if(!dir_exist(destpath))
+			return ovcp_response_error(OVCP_ERROR_BACKUPFAIL, OVCP_ERROR_BACKUPFAIL_DESC);
+			
 		snprintf(srcpath, BUF_SIZE, "%s/%s", global_settings.image_dir, "rescue");
 		ret = readlink(srcpath, destpath, BUF_SIZE);
 				
@@ -351,10 +354,13 @@
 	
 		if(execb_cmd("mv", "mv", srcpath, destpath, NULL) != 0)
 			return ovcp_response_error(OVCP_ERROR_BACKUPFAIL, OVCP_ERROR_BACKUPFAIL_DESC);
+			
+		if(!dir_exist(destpath))
+			return ovcp_response_error(OVCP_ERROR_BACKUPFAIL, OVCP_ERROR_BACKUPFAIL_DESC);
 		
 		snprintf(srcpath, BUF_SIZE, "%s/%s", global_settings.root_dir, name);
 		if(execb_cmd("rm", "rm", "-rf", srcpath, NULL) != 0)
-			return ovcp_response_error(OVCP_ERROR_BACKUPFAIL, OVCP_ERROR_BACKUPFAIL_DESC);	
+			return ovcp_response_error(OVCP_ERROR_UABLDELETE, OVCP_ERROR_UABLDELETE_DESC);	
 
 		
 		snprintf(srcpath, BUF_SIZE, "%s/%s", global_settings.backup_dir, name);



More information about the Commits mailing list