SQLite

Check-in [f97bd520f0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure the directory used by os_unix.c for shared-memory files is always the same, regardless of individual client permissions and environment variable settings.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f97bd520f06a16c61ccdd9ebeda7e138896b9ac2
User & Date: drh 2010-06-02 15:59:06.000
Context
2010-06-02
16:39
Updated wal2.test for windows testing. (check-in: c3606f3985 user: shaneh tags: trunk)
15:59
Make sure the directory used by os_unix.c for shared-memory files is always the same, regardless of individual client permissions and environment variable settings. (check-in: f97bd520f0 user: drh tags: trunk)
15:43
When walTryBeginRead() encounters an I/O error trying to set a lock (as opposed to SQLITE_BUSY) be sure to propagate that error back up the call stack. (check-in: aa2c2b67a7 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
  const char *zDir = 0;

  azDirs[0] = sqlite3_temp_directory;
  if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
  
  if( allowShm ){
    zDir = "/dev/shm";
    i = 0;
  }else{
    zDir = azDirs[0];
    i = 1;
  }
  for(; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){
    if( zDir==0 ) continue;
    if( stat(zDir, &buf) ) continue;
    if( !S_ISDIR(buf.st_mode) ) continue;
    if( access(zDir, 07) ) continue;
    break;
  }
  return zDir;
}

/*
** Create a temporary file name in zBuf.  zBuf must be allocated







|








|







4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
  const char *zDir = 0;

  azDirs[0] = sqlite3_temp_directory;
  if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
  
  if( allowShm ){
    zDir = "/dev/shm";
    i = 2;  /* Skip the app-defined temp locations for shared-memory */
  }else{
    zDir = azDirs[0];
    i = 1;
  }
  for(; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){
    if( zDir==0 ) continue;
    if( stat(zDir, &buf) ) continue;
    if( !S_ISDIR(buf.st_mode) ) continue;
    if( !allowShm && access(zDir, 07) ) continue;
    break;
  }
  return zDir;
}

/*
** Create a temporary file name in zBuf.  zBuf must be allocated