mirror of
https://github.com/octoleo/restic.git
synced 2024-11-23 05:12:10 +00:00
commit
d596712339
@ -169,7 +169,7 @@ func (arch *Archiver) SaveTreeJSON(item interface{}) (Blob, error) {
|
||||
// SaveFile stores the content of the file on the backend as a Blob by calling
|
||||
// Save for each chunk.
|
||||
func (arch *Archiver) SaveFile(p *Progress, node *Node) (Blobs, error) {
|
||||
file, err := os.Open(node.path)
|
||||
file, err := node.OpenForReading()
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -11,6 +11,10 @@ import (
|
||||
"github.com/restic/restic/debug"
|
||||
)
|
||||
|
||||
func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return os.Open(n.path)
|
||||
}
|
||||
|
||||
func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
|
||||
stat, ok := fi.Sys().(*syscall.Stat_t)
|
||||
if !ok {
|
||||
|
@ -11,6 +11,10 @@ import (
|
||||
"github.com/restic/restic/debug"
|
||||
)
|
||||
|
||||
func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return os.OpenFile(node.path, os.O_RDONLY|syscall.O_NOATIME, 0)
|
||||
}
|
||||
|
||||
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
|
||||
stat, ok := fi.Sys().(*syscall.Stat_t)
|
||||
if !ok {
|
||||
|
@ -2,6 +2,10 @@ package restic
|
||||
|
||||
import "os"
|
||||
|
||||
func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return os.Open(n.path)
|
||||
}
|
||||
|
||||
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user