[Box Backup-commit] COMMIT r2142 - box/trunk/bin/bbackupquery

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Wed Apr 9 22:01:56 BST 2008


Author: chris
Date: 2008-04-09 21:01:56 +0000 (Wed, 09 Apr 2008)
New Revision: 2142

Modified:
   box/trunk/bin/bbackupquery/BackupQueries.cpp
Log:
Check the return code from system commands in bbackupquery, and if not
zero, give a warning and set the bbackupquery return code to
COMMAND_RETURN_ERROR.

Check for Restore_TargetPathNotFound on all platforms as it's not specific
to Windows.


Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/trunk/bin/bbackupquery/BackupQueries.cpp	2008-04-09 20:31:06 UTC (rev 2141)
+++ box/trunk/bin/bbackupquery/BackupQueries.cpp	2008-04-09 21:01:56 UTC (rev 2142)
@@ -117,7 +117,13 @@
 	if(Command[0] == 's' && Command[1] == 'h' && Command[2] == ' ' && Command[3] != '\0')
 	{
 		// Yes, run shell command
-		::system(Command + 3);
+		int result = ::system(Command + 3);
+		if(result != 0)
+		{
+			BOX_WARNING("System command returned error code " <<
+				result);
+			SetReturnCode(COMMAND_RETURN_ERROR);
+		}
 		return;
 	}
 
@@ -2054,14 +2060,12 @@
 		SetReturnCode(COMMAND_RETURN_ERROR);
 		break;
 		
-	#ifdef WIN32
 	case Restore_TargetPathNotFound:
 		BOX_ERROR("The target directory path does not exist.\n"
 			"To restore to a directory whose parent "
 			"does not exist, create the parent first.");
 		SetReturnCode(COMMAND_RETURN_ERROR);
 		break;
-	#endif
 
 	case Restore_UnknownError:
 		BOX_ERROR("Unknown error during restore.");




More information about the Boxbackup-commit mailing list