diff options
Diffstat (limited to 'llgo/third_party/gofrontend/libgo/go/os/file.go')
-rw-r--r-- | llgo/third_party/gofrontend/libgo/go/os/file.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llgo/third_party/gofrontend/libgo/go/os/file.go b/llgo/third_party/gofrontend/libgo/go/os/file.go index b4a74580162..e12428cbe12 100644 --- a/llgo/third_party/gofrontend/libgo/go/os/file.go +++ b/llgo/third_party/gofrontend/libgo/go/os/file.go @@ -255,3 +255,12 @@ var lstat = Lstat func Rename(oldpath, newpath string) error { return rename(oldpath, newpath) } + +// Many functions in package syscall return a count of -1 instead of 0. +// Using fixCount(call()) instead of call() corrects the count. +func fixCount(n int, err error) (int, error) { + if n < 0 { + n = 0 + } + return n, err +} |