mirror of
https://github.com/restic/restic.git
synced 2026-05-30 22:05:24 +00:00
vss: fix potential crash (not reachable in restic) (#3045)
HasSufficientPrivilegesForVSS() now returns an error
This commit is contained in:
@@ -556,8 +556,8 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
|
||||
|
||||
var targetFS fs.FS = fs.Local{}
|
||||
if runtime.GOOS == "windows" && opts.UseFsSnapshot {
|
||||
if !fs.HasSufficientPrivilegesForVSS() {
|
||||
return errors.Fatal("user doesn't have sufficient privileges to use VSS snapshots\n")
|
||||
if err = fs.HasSufficientPrivilegesForVSS(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
errorHandler := func(item string, err error) error {
|
||||
|
||||
@@ -286,7 +286,7 @@ func TestBackup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBackupWithFilesystemSnapshots(t *testing.T) {
|
||||
if runtime.GOOS == "windows" && fs.HasSufficientPrivilegesForVSS() {
|
||||
if runtime.GOOS == "windows" && fs.HasSufficientPrivilegesForVSS() == nil {
|
||||
testBackup(t, true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user