backup: Set O_NOATIME in the right place

The archiver uses FS.OpenFile, where FS is an instance of the FS
interface. This is different from fs.OpenFile, which uses the OpenFile
method provided by the fs package.
This commit is contained in:
Michael Eischer 2021-12-30 15:32:42 +01:00 committed by greatroar
parent 7080fed7ae
commit 6b17a7110c
2 changed files with 4 additions and 12 deletions

View File

@ -85,12 +85,7 @@ func Create(name string) (*os.File, error) {
// Open opens a file for reading.
func Open(name string) (File, error) {
f, err := os.Open(fixpath(name))
if err != nil {
return nil, err
}
setFlags(f)
return f, err
return os.Open(fixpath(name))
}
// OpenFile is the generalized open call; most users will use Open
@ -99,12 +94,7 @@ func Open(name string) (File, error) {
// methods on the returned File can be used for I/O.
// If there is an error, it will be of type *PathError.
func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error) {
f, err := os.OpenFile(fixpath(name), flag, perm)
if err != nil {
return nil, err
}
setFlags(f)
return f, err
return os.OpenFile(fixpath(name), flag, perm)
}
// Walk walks the file tree rooted at root, calling walkFn for each file or

View File

@ -24,6 +24,7 @@ func (fs Local) Open(name string) (File, error) {
if err != nil {
return nil, err
}
_ = setFlags(f)
return f, nil
}
@ -37,6 +38,7 @@ func (fs Local) OpenFile(name string, flag int, perm os.FileMode) (File, error)
if err != nil {
return nil, err
}
_ = setFlags(f)
return f, nil
}