Index: src/pragma.c ================================================================== --- src/pragma.c +++ src/pragma.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.186 2008/09/02 15:44:09 danielk1977 Exp $ +** $Id: pragma.c,v 1.187 2008/09/16 14:38:03 danielk1977 Exp $ */ #include "sqliteInt.h" #include /* Ignore this whole file if pragmas are disabled @@ -666,13 +666,14 @@ sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } }else{ #ifndef SQLITE_OMIT_WSD if( zRight[0] ){ + int rc; int res; - sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); - if( res==0 ){ + rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); + if( rc!=SQLITE_OK || res==0 ){ sqlite3ErrorMsg(pParse, "not a writable directory"); goto pragma_out; } } if( SQLITE_TEMP_STORE==0 Index: test/ioerr2.test ================================================================== --- test/ioerr2.test +++ test/ioerr2.test @@ -13,11 +13,11 @@ # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # -# $Id: ioerr2.test,v 1.9 2008/08/20 14:49:25 danielk1977 Exp $ +# $Id: ioerr2.test,v 1.10 2008/09/16 14:38:04 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !integrityck { @@ -129,7 +129,20 @@ } } } msg] list $rc $msg } {1 {callback requested query abort}} + +if {$::tcl_platform(platform) == "unix"} { + # Cause the call to xAccess used by [pragma temp_store_directory] to + # determine if the specified directory is writable to fail. This causes + # SQLite to report "not a writable directory", which is probably the + # right answer. + # + do_test ioerr2-6 { + set ::sqlite_io_error_hit 0 + set ::sqlite_io_error_pending 1 + catchsql {PRAGMA temp_store_directory = '/tmp/'} + } {1 {not a writable directory}} +} finish_test