Skip to content

Commit 7b5089a

Browse files
authored
Merge branch 'main' into fix-xread-short-read
2 parents 546564f + 6c416b6 commit 7b5089a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/vfs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,13 @@ unsafe extern "C" fn x_open<T: Vfs>(
421421
flags: c_int,
422422
p_out_flags: *mut c_int,
423423
) -> c_int {
424+
// From https://sqlite.org/c3ref/vfs.html:
425+
// "Note that the xOpen method must set the sqlite3_file.pMethods to either a valid
426+
// sqlite3_io_methods object or to NULL. xOpen must do this even if the open fails."
427+
if let Some(f) = unsafe { p_file.as_mut() } {
428+
f.pMethods = core::ptr::null();
429+
}
430+
424431
fallible(|| {
425432
let opts = flags.into();
426433
let name = unsafe { lossy_cstr(z_name) }.ok();

0 commit comments

Comments
 (0)