aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/afero/mem/file.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-09-01 16:01:23 +0200
committerGitHub <noreply@github.com>2020-09-01 10:01:23 -0400
commit3270e7a4435fceb757728dfc319fc04077a37caf (patch)
tree60dcaf02442e930c0b2c7bd7fe0f0b00190a402f /vendor/github.com/spf13/afero/mem/file.go
parent66843f22375b67a58746dac508b71200a96e68d6 (diff)
downloadgitea-3270e7a4435fceb757728dfc319fc04077a37caf.tar.gz
gitea-3270e7a4435fceb757728dfc319fc04077a37caf.zip
[Vendor] update go-swagger v0.21.0 -> v0.25.0 (#12670)
* Update go-swagger * vendor
Diffstat (limited to 'vendor/github.com/spf13/afero/mem/file.go')
-rw-r--r--vendor/github.com/spf13/afero/mem/file.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/vendor/github.com/spf13/afero/mem/file.go b/vendor/github.com/spf13/afero/mem/file.go
index 7af2fb56ff..699f1fb024 100644
--- a/vendor/github.com/spf13/afero/mem/file.go
+++ b/vendor/github.com/spf13/afero/mem/file.go
@@ -193,8 +193,11 @@ func (f *File) Read(b []byte) (n int, err error) {
}
func (f *File) ReadAt(b []byte, off int64) (n int, err error) {
+ prev := atomic.LoadInt64(&f.at)
atomic.StoreInt64(&f.at, off)
- return f.Read(b)
+ n, err = f.Read(b)
+ atomic.StoreInt64(&f.at, prev)
+ return
}
func (f *File) Truncate(size int64) error {
@@ -233,6 +236,9 @@ func (f *File) Seek(offset int64, whence int) (int64, error) {
}
func (f *File) Write(b []byte) (n int, err error) {
+ if f.closed == true {
+ return 0, ErrFileClosed
+ }
if f.readOnly {
return 0, &os.PathError{Op: "write", Path: f.fileData.name, Err: errors.New("file handle is read only")}
}