diff --git a/lib/backup/fscommon/fscommon.go b/lib/backup/fscommon/fscommon.go index fd9e3506b..37d688aeb 100644 --- a/lib/backup/fscommon/fscommon.go +++ b/lib/backup/fscommon/fscommon.go @@ -45,7 +45,7 @@ func fsync(path string) error { func AppendFiles(dst []string, dir string) ([]string, error) { d, err := os.Open(dir) if err != nil { - return nil, fmt.Errorf("cannot open %q: %w", dir, err) + return nil, fmt.Errorf("cannot open directory: %w", err) } dst, err = appendFilesInternal(dst, d) if err1 := d.Close(); err1 != nil { diff --git a/lib/backup/fslocal/fslocal.go b/lib/backup/fslocal/fslocal.go index 051182a62..055c38123 100644 --- a/lib/backup/fslocal/fslocal.go +++ b/lib/backup/fslocal/fslocal.go @@ -159,7 +159,7 @@ func (fs *FS) DeletePath(path string) (uint64, error) { // The file could be deleted earlier via symlink. return 0, nil } - return 0, fmt.Errorf("cannot open %q at %q: %w", path, fullPath, err) + return 0, fmt.Errorf("cannot open %q: %w", path, err) } fi, err := f.Stat() _ = f.Close() diff --git a/lib/backup/fsremote/fsremote.go b/lib/backup/fsremote/fsremote.go index 4e4939f91..d2a7ce851 100644 --- a/lib/backup/fsremote/fsremote.go +++ b/lib/backup/fsremote/fsremote.go @@ -107,12 +107,12 @@ func (fs *FS) CopyPart(srcFS common.OriginFS, p common.Part) error { // Cannot create hardlink. Just copy file contents srcFile, err := os.Open(srcPath) if err != nil { - return fmt.Errorf("cannot open file %q: %w", srcPath, err) + return fmt.Errorf("cannot open source file: %w", err) } dstFile, err := os.Create(dstPath) if err != nil { _ = srcFile.Close() - return fmt.Errorf("cannot create file %q: %w", dstPath, err) + return fmt.Errorf("cannot create destination file: %w", err) } n, err := io.Copy(dstFile, srcFile) if err1 := dstFile.Close(); err1 != nil { @@ -141,7 +141,7 @@ func (fs *FS) DownloadPart(p common.Part, w io.Writer) error { path := fs.path(p) r, err := os.Open(path) if err != nil { - return fmt.Errorf("cannot open %q: %w", path, err) + return err } n, err := io.Copy(w, r) if err1 := r.Close(); err1 != nil && err == nil {