diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-02-01 21:24:26 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-02-01 21:24:26 +0000 |
commit | 564f6ef783de04e574a7eab0c069ed5b1ec059c6 (patch) | |
tree | 060945c81fa466f8308e69ce0c35c4e019953c3d | |
parent | c59a386a9f0d8426397955e87788766ebe8f7a69 (diff) |
Fix missing snapshot path on subsequent locations.
Thanks to Kai Liebenau for finding and fixing this bug.
Also use VssFreeSnapshotProperties instead of rolling our own, also thanks to
Kai.
This has not been compile tested on Windows.
-rw-r--r-- | bin/bbackupd/BackupDaemon.cpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 3c5f2bf2..edd059af 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -1234,16 +1234,6 @@ bool BackupDaemon::CallAndWaitForAsync(AsyncMethod method, return WaitForAsync(pAsync, description); } -void FreeSnapshotProp(VSS_SNAPSHOT_PROP *pSnap) -{ - CoTaskMemFree(pSnap->m_pwszSnapshotDeviceObject); - CoTaskMemFree(pSnap->m_pwszOriginalVolumeName); - CoTaskMemFree(pSnap->m_pwszOriginatingMachine); - CoTaskMemFree(pSnap->m_pwszServiceMachine); - CoTaskMemFree(pSnap->m_pwszExposedName); - CoTaskMemFree(pSnap->m_pwszExposedPath); -} - void BackupDaemon::CreateVssBackupComponents() { std::map<char, VSS_ID> volumesIncluded; @@ -1449,21 +1439,6 @@ void BackupDaemon::CreateVssBackupComponents() " to snapshot set"); volumesIncluded[path[0]] = newVolumeId; rLocation.mSnapshotVolumeId = newVolumeId; - rLocation.mIsSnapshotCreated = true; - - // If the snapshot path starts with the volume root - // (drive letter), because the path is absolute (as - // it should be), then remove it so that the - // resulting snapshot path can be appended to the - // snapshot device object to make a real path, - // without a spurious drive letter in it. - - if (path.substr(0, volumeRoot.length()) == volumeRoot) - { - path = path.substr(volumeRoot.length()); - } - - rLocation.mSnapshotPath = path; } else { @@ -1478,8 +1453,23 @@ void BackupDaemon::CreateVssBackupComponents() BOX_TRACE("VSS: Skipping already included volume " << volumeRoot << " for backup location " << path); rLocation.mSnapshotVolumeId = i->second; - rLocation.mIsSnapshotCreated = true; } + + rLocation.mIsSnapshotCreated = true; + + // If the snapshot path starts with the volume root + // (drive letter), because the path is absolute (as it + // should be), then remove it so that the resulting + // snapshot path can be appended to the snapshot device + // object to make a real path, without a spurious drive + // letter in it. + + if (path.substr(0, volumeRoot.length()) == volumeRoot) + { + path = path.substr(volumeRoot.length()); + } + + rLocation.mSnapshotPath = path; } else { @@ -1600,7 +1590,7 @@ void BackupDaemon::CreateVssBackupComponents() rLocation.mSnapshotPath = WideStringToString(prop.m_pwszSnapshotDeviceObject) + DIRECTORY_SEPARATOR + rLocation.mSnapshotPath; - FreeSnapshotProp(&prop); + VssFreeSnapshotProperties(&prop); BOX_INFO("VSS: Location " << rLocation.mPath << " using " "snapshot path " << rLocation.mSnapshotPath); @@ -1698,7 +1688,7 @@ void BackupDaemon::CreateVssBackupComponents() } BOX_TRACE("VSS: Snapshot status: " << status); - FreeSnapshotProp(pSnap); + VssFreeSnapshotProperties(pSnap); } } |