aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go
diff options
context:
space:
mode:
authorale <ale@incal.net>2018-08-31 08:28:51 +0100
committerale <ale@incal.net>2018-08-31 08:28:51 +0100
commitb3d419486a87c9193c2fd6c16168f600876e0f73 (patch)
tree849d1333d4fac8e5654e65a0fdf4b2cb00355ab9 /vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go
parent86a0bd2d15a07662fdae4e24589b08706c2e80b9 (diff)
downloadcrawl-b3d419486a87c9193c2fd6c16168f600876e0f73.tar.gz
crawl-b3d419486a87c9193c2fd6c16168f600876e0f73.zip
Update dependencies
Diffstat (limited to 'vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go')
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go
index 7e29915..d75f66a 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go
@@ -67,13 +67,25 @@ func isErrInvalid(err error) bool {
if err == os.ErrInvalid {
return true
}
+ // Go < 1.8
if syserr, ok := err.(*os.SyscallError); ok && syserr.Err == syscall.EINVAL {
return true
}
+ // Go >= 1.8 returns *os.PathError instead
+ if patherr, ok := err.(*os.PathError); ok && patherr.Err == syscall.EINVAL {
+ return true
+ }
return false
}
func syncDir(name string) error {
+ // As per fsync manpage, Linux seems to expect fsync on directory, however
+ // some system don't support this, so we will ignore syscall.EINVAL.
+ //
+ // From fsync(2):
+ // Calling fsync() does not necessarily ensure that the entry in the
+ // directory containing the file has also reached disk. For that an
+ // explicit fsync() on a file descriptor for the directory is also needed.
f, err := os.Open(name)
if err != nil {
return err