[Box Backup-commit] COMMIT r1636 - box/chris/general/lib/backupclient
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Wed May 9 11:30:48 BST 2007
Author: chris
Date: 2007-05-09 11:30:48 +0100 (Wed, 09 May 2007)
New Revision: 1636
Modified:
box/chris/general/lib/backupclient/BackupClientRestore.cpp
Log:
Make directories user-writable while restoring them, so that restoring
read-only directories as a non-root user doesn't crash. Restore the
correct permissions after restoring the directory's contents.
(merges [1619] and [1620])
Modified: box/chris/general/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/general/lib/backupclient/BackupClientRestore.cpp 2007-05-09 10:29:21 UTC (rev 1635)
+++ box/chris/general/lib/backupclient/BackupClientRestore.cpp 2007-05-09 10:30:48 UTC (rev 1636)
@@ -412,7 +412,7 @@
try
{
- dirAttr.WriteAttributes(rLocalDirectoryName.c_str());
+ dirAttr.WriteAttributes(rLocalDirectoryName.c_str(), true);
}
catch (BoxException &e)
{
@@ -663,6 +663,30 @@
}
}
+ // now remove the user writable flag, if we added it earlier
+ try
+ {
+ dirAttr.WriteAttributes(rLocalDirectoryName.c_str(), false);
+ }
+ catch (BoxException &e)
+ {
+ ::syslog(LOG_ERR, "Failed to restore attributes for %s: %s",
+ rLocalDirectoryName.c_str(), e.what());
+ return Restore_UnknownError;
+ }
+ catch(std::exception &e)
+ {
+ ::syslog(LOG_ERR, "Failed to restore attributes for %s: %s",
+ rLocalDirectoryName.c_str(), e.what());
+ return Restore_UnknownError;
+ }
+ catch(...)
+ {
+ ::syslog(LOG_ERR, "Failed to restore attributes for %s: "
+ "unknown error", rLocalDirectoryName.c_str());
+ return Restore_UnknownError;
+ }
+
return Restore_Complete;
}
More information about the Boxbackup-commit
mailing list