Skip to content

Commit d0452d9

Browse files
committed
Prepare 3.51.0.
1 parent b65e894 commit d0452d9

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

internal/util/module.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@ func NewContext(ctx context.Context) context.Context {
2626
}
2727

2828
func GetSystemError(ctx context.Context) error {
29-
s := ctx.Value(moduleKey{}).(*moduleState)
30-
return s.sysError
29+
// Test needed to simplify testing.
30+
s, ok := ctx.Value(moduleKey{}).(*moduleState)
31+
if ok {
32+
return s.sysError
33+
}
34+
return nil
3135
}
3236

3337
func SetSystemError(ctx context.Context, err error) {
38+
// Test needed to simplify testing.
3439
s, ok := ctx.Value(moduleKey{}).(*moduleState)
3540
if ok {
3641
s.sysError = err

vfs/adiantum/hbsh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (h *hbshVFS) OpenFilename(name *vfs.Filename, flags vfs.OpenFlag) (file vfs
5656

5757
if hbsh == nil {
5858
file.Close()
59-
return nil, flags, sqlite3.CANTOPEN
59+
return nil, flags, sqlite3.IOERR_BADKEY
6060
}
6161
return &hbshFile{File: file, hbsh: hbsh, init: h.init}, flags, nil
6262
}
@@ -108,7 +108,7 @@ func (h *hbshFile) Pragma(name string, value string) (string, error) {
108108
if h.hbsh = h.init.HBSH(key); h.hbsh != nil {
109109
return "ok", nil
110110
}
111-
return "", sqlite3.CANTOPEN
111+
return "", sqlite3.IOERR_BADKEY
112112
}
113113

114114
func (h *hbshFile) ReadAt(p []byte, off int64) (n int, err error) {

vfs/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ type blockingSharedMemory interface {
207207
shmEnableBlocking(block bool)
208208
}
209209

210+
// FileControl makes it easy to forward all fileControl methods,
211+
// which we want to do for the checksum VFS.
212+
// However, this is not a safe default, and other VFSes
213+
// should explicitly wrap the methods they want to wrap.
210214
type fileControl interface {
211215
File
212216
fileControl(ctx context.Context, mod api.Module, op _FcntlOpcode, pArg ptr_t) _ErrorCode

vfs/xts/xts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (x *xtsVFS) OpenFilename(name *vfs.Filename, flags vfs.OpenFlag) (file vfs.
5555

5656
if cipher == nil {
5757
file.Close()
58-
return nil, flags, sqlite3.CANTOPEN
58+
return nil, flags, sqlite3.IOERR_BADKEY
5959
}
6060
return &xtsFile{File: file, cipher: cipher, init: x.init}, flags, nil
6161
}
@@ -103,7 +103,7 @@ func (x *xtsFile) Pragma(name string, value string) (string, error) {
103103
if x.cipher = x.init.XTS(key); x.cipher != nil {
104104
return "ok", nil
105105
}
106-
return "", sqlite3.CANTOPEN
106+
return "", sqlite3.IOERR_BADKEY
107107
}
108108

109109
func (x *xtsFile) ReadAt(p []byte, off int64) (n int, err error) {

0 commit comments

Comments
 (0)