sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zTempPath);
sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zDir);
int sqliteOsTempFileName(char *zBuf){#if OS_UNIX  static const char *azDirs[] = {     "/var/tmp",     "/usr/tmp",     "/tmp",     ".",  };  static unsigned char zChars[] =    "abcdefghijklmnopqrstuvwxyz"    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"    "0123456789";  int i, j;  struct stat buf;  const char *zDir = ".";  for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){    if( stat(azDirs[i], &buf) ) continue;    if( !S_ISDIR(buf.st_mode) ) continue;    if( access(azDirs[i], 07) ) continue;    zDir = azDirs[i];    break;  }  do{    sprintf(zBuf, "%s/"TEMP_FILE_PREFIX, zDir);    j = strlen(zBuf);    sqliteRandomness(15, &zBuf[j]);    for(i=0; i<15; i++, j++){      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];    }    zBuf[j] = 0;  }while( access(zBuf,0)==0 );#endif#if OS_WIN  static char zChars[] =    "abcdefghijklmnopqrstuvwxyz"    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"    "0123456789";  int i, j;  char zTempPath[SQLITE_TEMPNAME_SIZE];  GetTempPath(SQLITE_TEMPNAME_SIZE-30, zTempPath);  for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}  zTempPath[i] = 0;  for(;;){    sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zTempPath);    j = strlen(zBuf);    sqliteRandomness(15, &zBuf[j]);    for(i=0; i<15; i++, j++){      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];    }    zBuf[j] = 0;    if( !sqliteOsFileExists(zBuf) ) break;  }#endif#if OS_MAC  static char zChars[] =    "abcdefghijklmnopqrstuvwxyz"    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"    "0123456789";  int i, j;  char zTempPath[SQLITE_TEMPNAME_SIZE];  char zdirName[32];  CInfoPBRec infoRec;  Str31 dirName;  memset(&infoRec, 0, sizeof(infoRec));  memset(zTempPath, 0, SQLITE_TEMPNAME_SIZE);  if( FindFolder(kOnSystemDisk, kTemporaryFolderType,  kCreateFolder,       &(infoRec.dirInfo.ioVRefNum), &(infoRec.dirInfo.ioDrParID)) == noErr ){    infoRec.dirInfo.ioNamePtr = dirName;    do{      infoRec.dirInfo.ioFDirIndex = -1;      infoRec.dirInfo.ioDrDirID = infoRec.dirInfo.ioDrParID;      if( PBGetCatInfoSync(&infoRec) == noErr ){        CopyPascalStringToC(dirName, zdirName);        i = strlen(zdirName);        memmove(&(zTempPath[i+1]), zTempPath, strlen(zTempPath));        strcpy(zTempPath, zdirName);        zTempPath[i] = ':';      }else{        *zTempPath = 0;        break;      }    } while( infoRec.dirInfo.ioDrDirID != fsRtDirID );  }  if( *zTempPath == 0 )    getcwd(zTempPath, SQLITE_TEMPNAME_SIZE-24);  for(;;){    sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zTempPath);    j = strlen(zBuf);    sqliteRandomness(15, &zBuf[j]);    for(i=0; i<15; i++, j++){      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];    }    zBuf[j] = 0;    if( !sqliteOsFileExists(zBuf) ) break;  }#endif  return SQLITE_OK; }